/** * 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; }
/** * 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; }