Exemplo n.º 1
0
 protected function _getProductCollection()
 {
     if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
         return parent::_getProductCollection();
     }
     if (is_null($this->_productCollection)) {
         $tagModel = Mage::getModel('tag/tag');
         $collection = $tagModel->getEntityCollection();
         if (method_exists($collection, 'setSearchaniseRequest')) {
             $collection->setSearchaniseRequest(Mage::helper('searchanise')->getSearchaniseRequest());
         }
         if (!method_exists($collection, 'checkSearchaniseResult') || !$collection->checkSearchaniseResult()) {
             return parent::_getProductCollection();
         }
         $this->_productCollection = $collection;
         $this->_productCollection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addSearchaniseFilter()->addTagFilter($this->getTag()->getId())->addStoreFilter(Mage::app()->getStore()->getId())->addMinimalPrice()->addUrlRewrite()->setActiveFilter();
         Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_productCollection);
         Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_productCollection);
     }
     return $this->_productCollection;
 }
Exemplo n.º 2
0
 public function testSetListCollection()
 {
     $this->assertEmpty($this->_child->getData('collection'));
     $this->_block->setListCollection();
     $this->assertNotEmpty($this->_child->getData('collection'));
 }