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.

  • hi frinds please visit link:-merch.docs.magento.com/ce/user_guide/… – Ashvin Monpara Jun 30 '15 at 11:29
  • use this code:-echo this->getLayout()->createBlock("catalog/product_list")->setTemplate("catalog/product/list.phtml")->setCategoryId('category_id')->toHtml(); – Ashvin Monpara Jun 30 '15 at 11:32
  • @AshvinMonpara : where to add this code???????? – Manindra Singh Jun 30 '15 at 11:34
  • homepage.phtml use this code – Ashvin Monpara Jun 30 '15 at 11:35
  • @AshvinMonpara: i'm using cms block on page as i mention.i'm not using any homepage.phtml – Manindra Singh Jun 30 '15 at 11:39
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"}}
  • thanks for ur reply but somehow its not working for me.i have 17 products in category_id="16" and its displaying them all. – Manindra Singh Jun 30 '15 at 11:53
  • Oh too bad. Hmmmm... – jehzlau Jun 30 '15 at 11:59
  • How about limit="4" ? I updated my answer. Kindly try it. :) – jehzlau Jun 30 '15 at 11:59
  • no change same problem... :( – Manindra Singh Jun 30 '15 at 12:01
  • How about count="4" ? :D – jehzlau Jun 30 '15 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.