本文整理汇总了PHP中Varien_Data_Collection_Db::addAttributeToFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection_Db::addAttributeToFilter方法的具体用法?PHP Varien_Data_Collection_Db::addAttributeToFilter怎么用?PHP Varien_Data_Collection_Db::addAttributeToFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Collection_Db
的用法示例。
在下文中一共展示了Varien_Data_Collection_Db::addAttributeToFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addStatusFilterToOrders
/**
* Filter an order collection by status/state depending on MailUp config
* NOTE that cannot override collection consistently as the class changed name in 1.6
*
* @param Varien_Data_Collection_Db $collection
* @return $this
*/
public function addStatusFilterToOrders($collection)
{
$config = Mage::getModel('mailup/config');
// Add condition to skip orders that have incorrect statuses
$allowedStatuses = $config->getQualifyingOrderStatuses();
// If config options, use the given statuses
if (count($allowedStatuses) > 0) {
$collection->addAttributeToFilter('status', $allowedStatuses);
} else {
// Else, use complete, closed and processing state only
$allowedStates = $config->getDefaultQualifyingStates();
$collection->addAttributeToFilter('state', $allowedStates);
}
return $this;
}
示例2: addIncrementalFilter
/**
* Add filter to collection to make it only include records necessary for automatic daily feed (instead of one-time baseline feed).
*
* @param Varien_Data_Collection_Db $collection Collection of data which will be spit out as feed
*/
protected function addIncrementalFilter($collection, $incrementalDate = NULL)
{
Mage::helper('mybuys')->log('Adding incremental filters to product feed', Zend_Log::INFO, Mybuys_Connector_Helper_Data::LOG_FILE);
// daily feeds do not include out of stock items Filter on in_stock
$collection->addAttributeToFilter('is_in_stock', 1);
// No incremental date filtering of this feed
return $collection;
}