You might have noticed when browsing our Magento extensions that we display the list of new products on our home page. In order to do this we are our using our Magento product sorting extension.
To create something similar on your site, all you need to do is follow these steps:
- Go to CMS -> Pages in your Magento backend
- Click on whichever CMS page is your homepage
- Click the Design tab to edit the design of the page
- Add the following XML to the design:
123456789101112<reference name="content"><block type="ewpsorting/product_list" name="product_list" template="catalog/product/list.phtml"><!--<action method="setCategoryId"><category_id>3</category_id></action>--><action method="setColumnCount"><count>4</count></action><action method="setSortBy"><sort_by>creation</sort_by></action><block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"><action method="setDefaultMode"><mode>grid</mode></action><block type="page/html_pager" name="product_list_toolbar_pager"/></block><action method="setToolbarBlockName"><name>product_list_toolbar</name></action></block></reference>
There are a few lines from this xml code that you can edit in order to better serve your needs:
1 |
<!--<action method="setCategoryId"><category_id>3</category_id></action>--> |
You can specify to only show products within a certain category. To do that, you will want to uncomment this line. You can replace the category ID with any category ID from teh store
1 |
<action method="setColumnCount"><count>4</count></action> |
This is the number of products displayed in a row when viewed in grid mode. You can change the number to any number you want.
1 |
<action method="setSortBy"><sort_by>creation</sort_by></action> |
This is the most important line and is what will determine how the products are sorted. In this instance we are sorting by creation. As a result, newest products will display first. You can also sort by bestseller, popularity, revenue per view, revenue per order, featured, review count, and more. More information is in the user guide of the Magento product sorting extension.