Magento – Display new products on the home page

If you’ve ever wanted to add new products in your Magento home page, it’s fairly easy to implement. Go to “CMS” then “Manage Pages” and select “Home Page” from the list of pages. Now paste this code snippet to show products labeled as “new” on your front page:

(Note that you must have some new products in your catalog for anything to show when you do this. This doesn’t mean that you’ve recently added them; only products explicitly marked as new using “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin tool will be shown.)

103 thoughts on “Magento – Display new products on the home page”

  1. but how to control the number of products display in row and column? Say I want to have 8 new products to display at the main page, with 4 products in a row in 2 columns, is that possible?

  2. Hi Richard,

    I’ve tried the above and it works although, in my template when i set more then 3 products it goes off the table, instead of adding a second row.

    Any idea how to fix it? I’ve tried to set a limit on css, though it doesn’t seem to work…

  3. ok i found the error

    if copying the displayed test its no good. u have to select the icons that pops up by hovering the text with the mousepointer and select the icon “copy to clipboard” then the code is right,

    Tx for the code just what i needed. 🙂

  4. Hello,

    great write up! It works for me, but I get duplicated blocks, and I don’t know why… Any ideas? It doesn’t matter what product I set up as NEW, still I get duplicated New Product blocks.

  5. Hey Richard, this is great. However, when I put the code in my page, it overlaps my other design, is there a quick way to resize the block? I went into the new.phtml file and I can’t find what I’m looking for.

  6. Scratching my head for a good while trying to get more than 5 latest products to show up, your instructions worked perfectly – THANKS!

  7. Thanks for this code. I have it working but with problems. The main problem is that all products are being displayed, even simple products with a “nowhere” display setting. Any suggestions as to how to display only products I’ve chosen to display in my “catalog,search”?

  8. I found the solution. Ok, what should we do to make visible the new products in your website(homepage or else where) :

    Firstly, don’t forget to sign out the product attributes “Set Product as new from date”-“Set Product as new to date”in general information. Try to edit “from date” before today.

    Then if you want to see more than 5 product in your homepage :

    don’t forget about the core:

    app\code\core\Mage\Catalog\Block\Product\New.php and edit the constant:

    {syntaxhighlighter brush: php}

    const DEFAULT_PRODUCTS_COUNT = 8;

    {/syntaxhighlighter}

    This constant respond to how many products will be visible in your page.

  9. Nice post and thread! I seems a lot of people are having problems with the homepage in Magento, which is quite a crucial part of the site! Thanks Richard for all your info on this.

  10. Hi Richard,

    Now its working fine in my site. Thanks for your help.

    The new products title showing as “New Products”, I would like to show as “New Products for October 2009”

    can you please help me out.

    With Regards

    Venkat

  11. Hi Richards,

    It seems you have deleted my comment. I sincerely posted my comment.

    Anyhow i used the code you have mentioned above.

    I have updated the code with 8 products. It is coming in single row and overlapping the right sidebar.

    Help me to show 4 products a row and up to 5 rows please

    site http://www.theplrmart.com

    Regards

    venkat

  12. Hi!

    I have a problem with new products, i search in all answers but is a different problem. I add my products but it doesn’t appear in new products, i update the date “Set Product as New from Date ” and ” Set Product as New to Date” and put the date of yesterday i both of them.

    but today when i open the site the products doesn’t appear. I don’t know why sometimes the products appear and another one disappear. Thxs for all!

  13. Hey Richard,

    Was wondering if there’s a way to edit the coding, so that it shows the 10 most recently added products to the store without using the new from and to date flag. This will be very useful to me (and many others i would believe) because i don’t update my site with new products very often, and lets say i normally flag a products as new for a max period of 7 days, after 8 days this coding wont show any products and my homepage will be lacking content.

    I want it to always show the last 10 products regardless of whether its still flag as new. Hope you can help, thanks in advanced!

  14. What’s up Richard,

    Wow, I’m really impressed with this, man? I can’t believe you actually take the time to respond to every reply personally. I hope karma is good to you – you deserve it 🙂

    Just wanted to say thanks for this small but helpful explanation. It has proven essential in a website I was making for someone and you saved me a whole bunch of time trying to reinvent the wheel. Not just your own post, but your replies to further inquiries as well! Thanks so much!

    Keep up the good work man,

    ~Adrian

  15. Richard, you are a hero! Thank you so much for sharing this with us. I really am so happy to having found a solution to this issue :o)

    Big smile from DK

  16. Hey! A little note: I just noticed this little line in the “new.phtml” (/app/design/frontend/default/YOUR_TEMPLATE/template/catalog/product/new.phtml) of my theme:

    5): continue; endif; ?>

    This would make the loop stop after 5 fragments, even when DEFAULT_PRODUCTS_COUNT is set to any higher variable. I think I saw some people here having problem with this? This might solve their problem 🙂 Hope it helps!

  17. Sorry, apparently that PHP line somehow didn’t make it through your system. Could you fix it in the other comment for me, Richard? You can remove this one afterwards. Thanks!

    The line I was talking about was:

    {syntaxhighlighter brush: php}

    < ?php if ($i>5): continue; endif; ?>

    {/syntaxhighlighter}

  18. hello sir I am beginner with magneto. so there is no one that help me . sir tell me that how i can remove the default blocks in magneto home page, like back to school and some others, i us 3 column layout, waiting for ur kind response.

  19. thanks a ton Richard above trick worked on mine

    can u help me in below thing.

    i want to create a page so that i can show top 10 best products on click of a link

    if u don’t know my e mail by replying to this comment section u can use this vaseem@doomshell.com

    Thanks

  20. HI Richard and many thanks for some really informative posts.

    I need to do exactly the same as Simon has requested above but cannot find a way to do this despite several days of trying – any ideas would be much appreciated.

  21. hey there,

    With regards to the new products on the homepage, I wanted to know about making 2 rows of 4 instead of the default 3 products showing.

    Thanks in advance for the support

    M

  22. editing any files to change the products_count value is not necessary

    you just have to set the number of products you want to display via products_count:

    {syntaxhighlighter brush: xml}

    {{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” products_count=”40″ template=”catalog/product/new.phtml”}}

    {/syntaxhighlighter}

  23. i displaying products form new.phtml file on my home page.

    Right now i display only one product [Product Image] on Home Page

    but what i needed is to display random image from Date set [From & To] on each of the products

    So at time the random image will be displayed from product for which date has been set..i want to know a if i set today’s date on my new product and date of tomorrow and other products having date from yesterday to day after tomorrow so which product should display first ?

    can u have your tip on this…

    Thank you…

  24. Guys, you don’t need to edit new.phtml to get how many rows you want. in your CMS Page just add column_count=”4″, result will be like this:

    {syntaxhighlighter brush: xml}

    {{block type=”catalog/product_new” name=”home.catalog.product.new” column_count=”4″ alias=”product_homepage” template=”catalog/product/new.phtml”}}

    {/syntaxhighlighter}

  25. I have to display 24 new products on home page, I tried all solution provided here, but unable to get sucess, please suggest me appropriate solution.

    I also tried

    {syntaxhighlighter brush: xml}

    {{block type=”catalog/product_new” name=”home.catalog.product.new” column_count=”8″ products_count=”24″ alias=”product_homepage” template=”catalog/product/new.phtml”}}

    {/syntaxhighlighter}

    in home page in CMS. but it is showing maximum 9 products only.

  26. Hi richard,

    i have a media folder which contains the product and categories contents i do have a csv file which contains the product details.

    How to import these to my site please give me a step by step procedure for this process.its little urgent(csv import and export options)

    Thanks

    Sriraman

  27. How can I get products from a different RSS feed to show up. For example, I keep a category of New Releases and use the RSS Feed per category option. So instead of using the “set product from new..” on EVERY item, which I find DOESN’T work when importing from a CSV, can I just use a different category RSS feed, like mentioned above the “new releases” one, to show the products?

  28. hey richard, how do change the number of columns of products to 3 so that they fit exactly in the homepage. The codes work properly but there are additional lines on the home page. Am very new to magento. thanx a lot!

  29. HI Richard i have done Like this as below video URL

    and as you said also but i cant get Products on home page can you help me?

    http://vimeo.com/1070986

    as i done as above video i get this message on home page

    There are no products matching the selection.

    i have set date setfrom and set to in general still i get this error

    can u help me?

  30. hey after getting Lots of spending time on that i get Solution

    if some 1 is find message like this

    There are no products matching the selection.

    and first check setfrom and settodate fill it

    and then paste this content

    {syntaxhighlighter brush: xml}

    {{block type=”catalog/product_list” category_id=”8″ template=catalog/product/list.phtml}}

    {/syntaxhighlighter}

    i get There are no products matching the selection. because i double quote template so when i removed that double quote then all products are showing of that category

    Hope for some 1 usefull….

  31. I am getting this error :-s

    Fatal error: Call to a member function count() on a non-object in /app/design/frontend/default/modern/template/catalog/product/new.phtml on line 35

  32. Hi Richard,

    I have two questions:

    How can I make a category where the new products (new from -at) were be showed?

    -is it possible to make a block for the right or left bar with the last 3 new products?? with thumbnail ?? I tryed it and tryed it, and… but successless

    Best Regards

    Brigitte

  33. Richard is there a way to display all new products in one page. I want to display only 8 new products in homepage and underneath those eight items a link to show all new products and displayed as ordinary listing of products.

  34. Hi sir richard, Thanks for a GreAT post, it really helps me… one more thing, is it possible if i want to put new products in my left column? thanks in advance 🙂

  35. Hello All,

    I would like to get a New Arrivals page, where all new products are sorted by date (small date banner above every new set of products).

    And a List/Grid mode so a infinite number of new products is possible to be viewed.

    Can anyone help me with that? At this moment I’ve made a page with 4 columns 16 items, but I want it to go to a next page containing more new products.

    Thanks in advance

  36. If you have entered simple products to Magento and you want to rearrange how they position, can you do so?

    I have trying re-SKUs, disabling/enabling products, moving to other categories temporarily.

    Any ideas would be helpful. Thanks

  37. Hi Richard,

    I’m having trouble getting the product price displayed on my homepage for the new products. What code can I add to my new.phtml file to make it look up the product price?

    Thanks,

    Annemieke

  38. Hi Richard

    I am working on Magento project, I have a issue some product url setting in home, i have home page in my site which display the product from different

    Category e.g best sell, hot deal, new, so i want to change url on home as after domain name e.g it should be, http://sitename.com/best_sell/product_url.html but i want to same like http://sitename.com/product_url.html.. only on home page and inner catalog working is fine..

    So is there any solution to fix the problem.?

    Reply me it will be really appreciated.

  39. Hi,

    This was one of my questions for a long time. But I use ver. 1.5 and I’m not sure to add the code on design, Layout Update XML? or under Content?

    Beside: I have defined 2 products as new, but there is no deference between new and normal products on front-end. Is there anything else I should do to show new products to be marked in some how?

    Best regards

  40. I am baffled. in Magento ver. 1.5.1.0 it only displays the last product that has it’s date set, but it works fine in Magento ver. 1.6.0.0. However I need it working in 1.5.1.0

    so if there are two products only one appears.

    I just cant seem to work out why!

    Any thoughts?

    thanks

    Jen

  41. Thanx Richard.

    I wonder there is a way to show sold products too ?

    Basically what I want is show 3 groups/tabs on homepage to show New, Sold, and Bestseller products on homepage.

    Any Idea?

  42. Has anyone confirmed this to be working in magento 1.5.1? I followed the example but can’t get the products to display. Are there any useful debugging techniques for me to check on why this does not work?

  43. Just what I needed! Thanks!

    I have created a duplicate of new.phtml, so that I could modify a few things about it in order to allow it to better fit my theme. One thing I cannot figure out is how to remove the bullets that appear to the top-left corner of each product image. I am using Dreamweaver to edit, and if I simply delete the bullet in ‘Live’ view, the products appear in a single column with the ‘Add to cart’ button being pushed to the very bottom of the column. I would greatly appreciate any help you can offer!

    Screenshot here: https://docs.google.com/open?id=0B0Ss17x8m3h3Nm5NeEpGdmZ1NFU

    Here is my code:

    ?>

    < ?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>

    < ?php echo $this->__(”) ?>

    < ?php $_columnCount = $this->getColumnCount(); ?>

    < ?php $i=0; foreach ($_products->getItems() as $_product): ?>

    < ?php if ($i++%$_columnCount==0): ?>

  44. < ?php if ($i%$_columnCount==0 || $i==count($_products)): ?>

    < ?php endif ?>

    < ?php endforeach; ?>

    < ?php endif; ?>

  • Thanks for this. But I am curious. What code can I use if I want to put the code under the layout xml instead of the content section.

    Thanks

  • Leave a Reply

    Your email address will not be published. Required fields are marked *