コード例 #1
0
ファイル: Abstract.php プロジェクト: blazeriaz/youguess
 /**
  * Retrieve Index Product Collection
  *
  * @return Mage_Reports_Model_Resource_Product_Index_Collection_Abstract
  */
 public function getItemsCollection()
 {
     if (is_null($this->_collection)) {
         $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
         $this->_collection = $this->_getModel()->getCollection()->addAttributeToSelect($attributes);
         if ($this->getCustomerId()) {
             $this->_collection->setCustomerId($this->getCustomerId());
         }
         $this->_collection->excludeProductIds($this->_getModel()->getExcludeProductIds())->addUrlRewrite()->setPageSize($this->getPageSize())->setCurPage(1);
         /* Price data is added to consider item stock status using price index */
         $this->_collection->addPriceData();
         $ids = $this->getProductIds();
         if (empty($ids)) {
             $this->_collection->addIndexFilter();
         } else {
             $this->_collection->addFilterByIds($ids);
         }
         $this->_collection->setAddedAtOrder();
         if ($this->_useProductIdsOrder && is_array($ids)) {
             $this->_collection->setSortIds($ids);
         }
         Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_collection);
     }
     return $this->_collection;
 }
コード例 #2
0
ファイル: Abstract.php プロジェクト: codercv/urbansurprisedev
 /**
  * Retrieve Index Product Collection
  *
  * @return Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
  */
 public function getItemsCollection()
 {
     if (is_null($this->_collection)) {
         $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
         $this->_collection = $this->_getModel()->getCollection()->addAttributeToSelect($attributes)->excludeProductIds($this->_getModel()->getExcludeProductIds())->addUrlRewrite()->setAddedAtOrder()->setPageSize($this->getPageSize())->setCurPage(1);
         $ids = $this->getProductIds();
         if (empty($ids)) {
             $this->_collection->addIndexFilter();
         } else {
             $this->_collection->addFilterByIds($ids);
         }
         Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_collection);
     }
     return $this->_collection;
 }