Display Bestsellers for Specific Magento Categories in CMS page.
Following tutorial,
https://mercytapscott.com/display-bestsellers-for-specific-magento-categories/
Added following line into cms content
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="5"}}
Getting error.
My code :
app/code/local/Mage/Catalog/Block/Product/Bestseller.php app/design/frontend/default/theme/template/catalog/product/bestseller.phtml
If any configuration error or anything else?
error message :
Fatal error: Call to a member function productAttribute() on null in /home/abc/public_html/app/design/frontend/default/theme/template/catalog/product/bestseller.phtml on line 6
@Aveeva use this <?php $_helper = Mage::helper('catalog/output'); ?>
You are calling the function using helper but you don't have created the helper instance.
Thanks
@rahul Gupta How to add more than one category,
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="16"}}
If i add like,
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="5"}}
<br>
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="16"}}
<br>
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="10"}}
Displayed same category (5)
@Aveeva you can pass like this.
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" category_id="5,16,10"}}
In this way you can get array of category_id and then you can use them one by one.
Thanks
@rahul Gupta Yes, i tried this. Same category list showing for all products.
@Aveeva after this on your template file where your are getting the category id now you are getting the array there?
@rahul Gupta This is the tutorial i am following, https://mercytapscott.com/display-bestsellers-for-specific-magento-categories/
@Aveeva i have checked this.
In this where you are getting the category you have to apply that code inside foreach loop for categories array.
Thanks
@rahul Gupta In the cms page content section i am added my category id. I am shared tutorial link what i followed.
can you pls explain in detail : inside foreach loop for categories array.