2

i'm working on magento 1.9 with b-responsive theme. i want to show only 4 product of a specific categoy on my home page but unable to do so. i have changed the product page and it shows all product without pagination on a single page for every category.

for that i have copied app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php to app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php and change the line:

$limit = 'all';

now it shows all products of that category in one page.but on my home page when i call a block i want to show only 4 product of that category.

Here is my code on my home page:

{{block type="catalog/product_list" column_count="4" category_id="16" template="catalog/product/list_notoolbar.phtml"}}

and it showing all product of that category but i want to show only four products.how can i achieve that.

8
  • hi frinds please visit link:-merch.docs.magento.com/ce/user_guide/… Jun 30, 2015 at 11:29
  • use this code:-echo this->getLayout()->createBlock("catalog/product_list")->setTemplate("catalog/product/list.phtml")->setCategoryId('category_id')->toHtml(); Jun 30, 2015 at 11:32
  • @AshvinMonpara : where to add this code???????? Jun 30, 2015 at 11:34
  • homepage.phtml use this code Jun 30, 2015 at 11:35
  • @AshvinMonpara: i'm using cms block on page as i mention.i'm not using any homepage.phtml Jun 30, 2015 at 11:39

1 Answer 1

2

Try this adding limit, just like this:

{{block type="catalog/product_list" limit="4" column_count="4" category_id="16" template="catalog/product/list_notoolbar.phtml"}}
8
  • thanks for ur reply but somehow its not working for me.i have 17 products in category_id="16" and its displaying them all. Jun 30, 2015 at 11:53
  • Oh too bad. Hmmmm...
    – jehzlau
    Jun 30, 2015 at 11:59
  • How about limit="4" ? I updated my answer. Kindly try it. :)
    – jehzlau
    Jun 30, 2015 at 11:59
  • no change same problem... :( Jun 30, 2015 at 12:01
  • How about count="4" ? :D
    – jehzlau
    Jun 30, 2015 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.