Exemplo n.º 1
0
 protected function _getCollection()
 {
     if ($this->getRequest()->getRouteName() == 'checkout') {
         return parent::_getCollection();
     }
     switch ($this->helper('icart')->getShowProductsBlock()) {
         case 'related':
             $collection = Mage::getModel('catalog/product_link')->useRelatedLinks()->getProductCollection()->setStoreId(Mage::app()->getStore()->getId())->addStoreFilter()->setPageSize($this->_maxItemCount);
             break;
         case 'up-sells':
             $collection = Mage::getModel('catalog/product_link')->useUpSellLinks()->getProductCollection()->setStoreId(Mage::app()->getStore()->getId())->addStoreFilter()->setPageSize($this->_maxItemCount);
             break;
         case 'cross-sells':
             $collection = Mage::getModel('catalog/product_link')->useCrossSellLinks()->getProductCollection()->setStoreId(Mage::app()->getStore()->getId())->addStoreFilter()->setPageSize($this->_maxItemCount);
             break;
         default:
             exit;
             break;
     }
     $this->_addProductAttributesAndPrices($collection);
     Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
     return $collection;
 }