本文整理匯總了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();
}