本文整理汇总了PHP中Varien_Data_Collection::addFieldToFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection::addFieldToFilter方法的具体用法?PHP Varien_Data_Collection::addFieldToFilter怎么用?PHP Varien_Data_Collection::addFieldToFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Collection
的用法示例。
在下文中一共展示了Varien_Data_Collection::addFieldToFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _filterInSetsCondition
/**
* @param Varien_Data_Collection $collection
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
*/
protected function _filterInSetsCondition($collection, $column)
{
$selected = $this->_getSelectedAttributeSets();
if (empty($selected)) {
$selected = '0';
}
$value = $column->getFilter()->getValue();
if ($value) {
$collection->addFieldToFilter('main_table.attribute_set_id', array('in' => $selected));
} else {
$collection->addFieldToFilter('main_table.attribute_set_id', array('nin' => $selected));
}
}
示例2: _prepareCollection
protected function _prepareCollection()
{
$quote = $this->getOrder()->getQuote();
if ($quote) {
$collection = $quote->getItemsCollection(false);
} else {
$collection = new Varien_Data_Collection();
}
$collection->addFieldToFilter('parent_item_id', array('null' => true));
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例3: _prepareCollection
protected function _prepareCollection()
{
$customer = Mage::registry('current_customer');
$storeIds = Mage::app()->getWebsite($this->getWebsiteId())->getStoreIds();
$quote = Mage::getModel('sales/quote')->setSharedStoreIds($storeIds)->loadByCustomer($customer);
if ($quote) {
$collection = $quote->getItemsCollection(false);
} else {
$collection = new Varien_Data_Collection();
}
$collection->addFieldToFilter('parent_item_id', array('null' => true));
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例4: _prepareCollection
protected function _prepareCollection()
{
$quote = Mage::getModel('Mage_Sales_Model_Quote');
// set website to quote, if any
if ($this->getWebsiteId()) {
$quote->setWebsite(Mage::app()->getWebsite($this->getWebsiteId()));
}
$quote->loadByCustomer(Mage::registry('current_customer'));
if ($quote) {
$collection = $quote->getItemsCollection(false);
} else {
$collection = new Varien_Data_Collection();
}
$collection->addFieldToFilter('parent_item_id', array('null' => true));
$this->setCollection($collection);
return parent::_prepareCollection();
}