Hi,thank you for your reply. This function resides in app/code/community/Magazento/Easytopsell/Block/Home.php. In this directory,There have other documents:Category.php Based on your repair,I try to modify this document,it is work. protected function _beforeToHtml() { $storeId = Mage::app()->getStore()->getId(); $sellDate=$this->getModel()->getSellDate($this->getModel()->getCatDaysLimit()); $collection = Mage::getResourceModel(‘reports/product_sold_collection’) ->setStoreId($storeId) ->addStoreFilter($storeId) ->addUrlRewrite() ->addOrderedQty() ->setDateRange($sellDate[‘startdate’], $sellDate[‘todaydate’]) ; if ($collection->isEnabledFlat()) { $collection->getSelect() ->joinLeft( array(‘cpl’ => $collection->getResource()->getFlatTableName()), “e.entity_id = cpl.entity_id” ) ->where(“cpl.visibility IN (?)”, array( Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH ) ); } else { $collection->addAttributeToFilter(‘cpl.visibility’, array( ‘in’ => array( Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH ) ) ); } $collection->addAttributeToFilter(‘status’, Mage_Catalog_Model_Product_Status::STATUS_ENABLED) ->setOrder(‘ordered_qty’, ‘desc’) ->setPageSize($this->getModel()->getCatProductsLimit()) ->setCurPage(1) ->setOrder(‘ordered_qty’, ‘desc’); $c = Mage::registry(“current_category”); $catId = $c->getData(‘entity_id’); if ($catId>0) { $category = $this->getModel()->getCategory($catId); $collection->addCategoryFilter($category); } $this->setProductCollection($collection); return parent::_beforeToHtml(); } This function resides in app/code/community/Magazento/Easytopsell/Block/Category.php.
http://www.magentocommerce.com/magento-connect/magento-mostviewed-mostpopular-products-free-7566.html Could you fix this extension on flat catalog? They are magazento’s expansion. Structure and code are very similar. Thank you !
http://www.magentocommerce.com/magento-connect/bnm-best-selling-products-new-products-and-most-viewed-products.html this expansion is very good,Could you fix this extension on flat catalog too?
Good Repair!!!Thank you! Homepage is ok,but how to repair Catalog page?
Hi, perhaps you mean Category page? Please be more specific, perhaps also supply a url so I can see the problem. Cheers, Michael.
Hi,thank you for your reply. This function resides in app/code/community/Magazento/Easytopsell/Block/Home.php. In this directory,There have other documents:Category.php Based on your repair,I try to modify this document,it is work. protected function _beforeToHtml() { $storeId = Mage::app()->getStore()->getId(); $sellDate=$this->getModel()->getSellDate($this->getModel()->getCatDaysLimit()); $collection = Mage::getResourceModel(‘reports/product_sold_collection’) ->setStoreId($storeId) ->addStoreFilter($storeId) ->addUrlRewrite() ->addOrderedQty() ->setDateRange($sellDate[‘startdate’], $sellDate[‘todaydate’]) ; if ($collection->isEnabledFlat()) { $collection->getSelect() ->joinLeft( array(‘cpl’ => $collection->getResource()->getFlatTableName()), “e.entity_id = cpl.entity_id” ) ->where(“cpl.visibility IN (?)”, array( Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH ) ); } else { $collection->addAttributeToFilter(‘cpl.visibility’, array( ‘in’ => array( Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH ) ) ); } $collection->addAttributeToFilter(‘status’, Mage_Catalog_Model_Product_Status::STATUS_ENABLED) ->setOrder(‘ordered_qty’, ‘desc’) ->setPageSize($this->getModel()->getCatProductsLimit()) ->setCurPage(1) ->setOrder(‘ordered_qty’, ‘desc’); $c = Mage::registry(“current_category”); $catId = $c->getData(‘entity_id’); if ($catId>0) { $category = $this->getModel()->getCategory($catId); $collection->addCategoryFilter($category); } $this->setProductCollection($collection); return parent::_beforeToHtml(); } This function resides in app/code/community/Magazento/Easytopsell/Block/Category.php.
Ok, and does your fix work?
http://www.magentocommerce.com/magento-connect/magento-mostviewed-mostpopular-products-free-7566.html Could you fix this extension on flat catalog? They are magazento’s expansion. Structure and code are very similar. Thank you !
I can give it a shot when I have some free time. I’ll post my findings if I have any news. Cheers, Michael.
http://www.magentocommerce.com/magento-connect/bnm-best-selling-products-new-products-and-most-viewed-products.html this expansion is very good,Could you fix this extension on flat catalog too?