Stumped on how to display new products on your ecommerce site using Magento? See these tips from our web developer and “master of Magento” below:
How to display new products in Magento
For a client website, they needed to display their newest products on their own page. To do this I created a new CMS page entitled, go figure, “New Arrivals”. Using the ‘custom design’ options that Magento affords for each CMS page I added a block to pull all the products that are marked as ‘new’. To mark a product as new one must have set a date for the “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin. Failure to mark these will keep the block from displaying anything at all.
Within the ‘custom design’ options I inserted the following:
<reference name="left"> <block type="catalog/navigation" before="-" name="catalog.sidebar" template="catalog/navigation/sidebar.phtml"/> </reference> <reference name="content"> <block type="catalog/product_new" name="home.catalog.product.new" template="catalog/product/new.phtml"/> </reference>
Each of the ‘references’ are initiating a new a block to put into the current CMS page with the ‘template’ file as the architecture. So for the ‘left’ reference, Magento will now insert the files from within sidebar.phtml, which, in this case, pulls the category navigation for the site. The ‘content’ reference will pull from the new.phtml to post all those products listed as new into the main area of the CMS page.
The first thing you might notice about the resulting display is that, no matter the number of products you have marked as ‘new’, you’re only seeing 5 of them. To correct this make a copy of the Magento file found at:
Place the copy in:
This way the new file is overwritten if and when you upgrade to a new version of Magento. In editing the New.php file you’ll find a line that says:
const DEFAULT_PRODUCTS_COUNT = 5;
Change that value to whatever you would like the upper end of your product count to be. In Zida’s case, it was ~100 products. Refresh the cache and you should now have a fully populated listing of your new products.
Minneapolis Magento Web Development
Need a Magento web developer in Minneapolis? Snap Agency has over 10 years of experience managing our own ecommerce stores on the Magento platform. We can do the same for you. Give us a call at (763) 548-2297 or email us to request a free consultation.