/**
  * Build product collection
  * @param  int $storeId Store id
  * @return Mage_Catalog_Model_Resource_Product_Collection
  *
  * The collection is formed thus:
  * 1. Since we are working with multiple stores, we use Mage:getResourceModel('catalog/product_collection') instead of
  * 		Mage::getModel('catalog/product')->getCollection() because the latter will load some store context we
  * 		prefer to control explicitly.
  * 2. setStore() is a method that will set up store context we do need. It does not set filtering.
  * 3. addAttributeToSelect() to get only the fields we need. Each product's _data will contain only these fields.
  * 4. addFieldToFilter() basically our 'where' clauses
  * 5. addStoreFilter() called without arguments defaults to the store most recently setStore()'d. Admin store is explicitly
  * 		ignored by addStoreFilter().
  * 6. setPageSize() in order to limit collection's use of memory. This is the number of products we'll load at once.
  */
 protected function _buildProductCollection($storeId)
 {
     $collection = Mage::getResourceModel('eems_display/product_collection')->setStore($storeId)->addAttributeToSelect(array('sku', 'name', 'short_description', 'price', 'special_price', 'special_from_date', 'special_to_date', 'url_key', 'image'))->addFieldToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE))->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->addStoreFilter()->addAttributeCharLimitToFilter('name', $this->_config->getProductTitleCharLimit())->addInStockToFilter()->setPageSize($this->_config->getProductFeedPageSize());
     return $collection;
 }
Example #2
0
 /**
  * Get last run duration text.
  * @return string
  */
 public function getLastRunDurationText()
 {
     return sprintf($this->_notice['last_run_duration_text'], $this->_config->getFeedLastRunDuration());
 }
Example #3
0
 /**
  * Calculating the time it took in minutes to successfully run the product feed by using the
  * the last run date time from configuration and the current time now.
  * @return float
  */
 protected function _calculateDuration()
 {
     $interval = $this->_helper->getDateInterval($this->_config->getFeedLastRunDatetime(), $this->_date->date(static::TIME_FORMAT));
     return $this->_helper->calculateTimeElapseInMinutes($interval);
 }