Wednesday, December 1, 2010

Magento - Display all products in Homepage with pagination




A client asked to create a Magento shop with Art Gallery like functionality. What she want is to have a product list in the homepage having pagination. Let's get it on!

  • In the backend:
    Manage Categories > set the default category to anchor:yes, then assign all products in this category
  • CMS->homepage > put this snippet in the layout update xml

<!-- ########################## DISPLAY ALL PRODUCTS IN HOMEPAGE ############################ -->
<reference name="content">
<block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
<update handle="page_two_columns_right" />
</reference>

6 comments:

  1. Very nice piece of work worked well for me with magento.

    http://www.boilersonline.com

    ReplyDelete
  2. Hi davendi

    glad it worked on your site. :)

    ReplyDelete
  3. I must say this is exactly what I was looking for.

    Previously I was listing all programs within my category but via the catalog/product model, adding pagination to that proved difficult.

    Thanks.

    ReplyDelete
  4. Thanks dear...
    this works great for me
    thank u very much

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. It is extremely nice to see the greatest details presented in an easy and understanding manner. german blog

    ReplyDelete