protected function _getProductCollection() { if (is_null($this->_productCollection)) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addAttributeToFilter('special_price', array('gt' => 0))->addAttributeToFilter(array(array('attribute' => 'special_from_date', 'lt' => new Zend_Db_Expr('NOW()')), array('attribute' => 'special_from_date', 'null' => '')), null, 'left')->addAttributeToFilter(array(array('attribute' => 'special_to_date', 'gt' => new Zend_Db_Expr('NOW()')), array('attribute' => 'special_to_date', 'null' => '')), null, 'left')->addAttributeToSelect('*')->addStoreFilter(); } return parent::_getProductCollection(); }
protected function _getProductCollection() { if (is_null($this->_productCollection)) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addAttributeToSelect('*')->addStoreFilter(); } return parent::_getProductCollection(); }
protected function _getProductCollection() { if (($attributeCode = $this->getAttributeCode()) && ($attributeValue = $this->getValue())) { if (is_null($this->_productCollection)) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addAttributeToFilter($attributeCode, array('eq' => $attributeValue))->addAttributeToSelect('*')->addStoreFilter(); } } return parent::_getProductCollection(); }
protected function _getProductCollection() { if (($attributeCode = $this->getAttributeCode()) && ($attributeValue = $this->getValue())) { if (is_null($this->_productCollection)) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addAttributeToFilter($attributeCode, array('eq' => $attributeValue))->addAttributeToSelect('*')->addStoreFilter(); $this->_addProductAttributesAndPrices($this->_productCollection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_productCollection); $this->setProductCollection($this->_productCollection); } } return parent::_getProductCollection(); }
protected function _getProductCollection() { if ($this->getIdPath()) { $categoryIdPath = explode('/', $this->getIdPath()); $this->setCategoryId($categoryIdPath[1]); } if (is_null($this->_productCollection) && ($category = Mage::getModel('catalog/category')->load($this->getCategoryId()))) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addCategoryFilter($category)->addAttributeToSelect('*')->addStoreFilter(); $this->prepareSortableFieldsByCategory($category); } return parent::_getProductCollection(); }
protected function _getProductCollection() { if ($this->getIdPath()) { $categoryIdPath = explode('/', $this->getIdPath()); $this->setCategoryId($categoryIdPath[1]); } if (is_null($this->_productCollection) && ($category = Mage::getModel('catalog/category')->load($this->getCategoryId()))) { $this->_productCollection = Mage::getResourceModel('reports/product_collection'); $this->_productCollection->addCategoryFilter($category)->addAttributeToSelect('*')->addStoreFilter(); $this->prepareSortableFieldsByCategory($category); if (!Mage::helper('cataloginventory')->isShowOutOfStock()) { Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($this->_productCollection); } } return parent::_getProductCollection(); }