cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 - CMS page products list error

Magento 1.9 - CMS page products list error

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

8 REPLIES 8

Re: Magento 1.9 - CMS page products list error

@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

Re: Magento 1.9 - CMS page products list error

@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)

Re: Magento 1.9 - CMS page products list error

@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

Re: Magento 1.9 - CMS page products list error

@rahul Gupta Yes, i tried this. Same category list showing for all products.

Re: Magento 1.9 - CMS page products list error

@Aveeva after this on your template file where your are getting the category id now you are getting the array there?

Re: Magento 1.9 - CMS page products list error

Re: Magento 1.9 - CMS page products list error

@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

Re: Magento 1.9 - CMS page products list error

@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.