Hi, I would like to know if inside any category page I can choose block Top Rated to only show product from that category. Thanks
1 answer
Hi, I would like to know if inside any category page I can choose block Top Rated to only show product from that category. Thanks
You can achieve this with a little change into code, you can open the file of app\code\local\JoomlArt\JmProducts\Block\list.php there around line number 198 you would see this snap code
PHP Code:
if($this->_config['catsid']){
// get array product_id
$arr_productids = $this->getProductByCategory();
$products = Mage::getResourceModel('catalog/product_collection')
->setStoreId($storeId)
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter($storeId)
->addIdFilter($arr_productids);
}else{
$products = Mage::getResourceModel('catalog/product_collection')
->setStoreId($storeId)
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter($storeId);
}
Right above it you add this code
PHP Code:
if(is_object(Mage::registry('current_category'))){
$this->_config['catsid'] = Mage::registry('current_category')->getId();
}
let me know if this helps !