Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 1 of 3
How do i add NEW products to Homepage? 
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

I’ve been trying to figure this out for weeks now and can’t seem to find a solution. I’m sure other people are trying to figure out how to accomplish this as well. If you know how to achieve this please reply to this post.

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendan.
Sr. Member
 
Total Posts:  181
Joined:  2008-07-16
Sydney, Australia
 

Hey,

Yep been in your position and it can be frustrating!

In Administration
1. Goto the CMS\Manage Pages
2. Open the Homepage
3. Select the Custom Design Option
4. Add the following

Between the section <reference name="content"> and </reference> add in the code for New Products as shown below

<reference name="content">

<!-- New 
Products -->
 <
block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml"
after="product_featured"/>

</
reference>

Now, Just make sure you have some products which have the date parameters set for the new products.

You should be good

cheers
Brendan

 Signature 

magento 1.1.6
PHP Version 5.2.6
http://www.getstuff.com.au

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

@ brendanb

Thank you for your reply. What i have showing in my CMS home page in Custom Design Tab is

<!--<reference name="content">
<
block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"/>
<
block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new"/>
<
block type="reports/product_compared" name="home.reports.product.compared" template="reports/home_product_compared.phtml" after="product_viewed" />
</
reference><reference name="right">
<
action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
<
action method="unsetChild"><alias>right.reports.product.compared</alias></action>

 <
block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml"
after="product_featured"/>

</
reference>-->
I added the code you posted below what was there already. I also updated Set Product as New from Date on a couple products. For some reason they are still not showing up for me on the home page. Am i doing something wrong?

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

Did brendanb’s solution work for anyone else?

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
jeff.d
Member
 
Total Posts:  54
Joined:  2008-05-26
 

You need to remove the “<!--” at the beginning and the “-->” and the end and it will work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

@ jeff.d Thanks for the advice.
Ok i was able to get to work, but the items are showing up Out Of Stock. Any one have a clue why they show up out of stock? I have the inventory set as Manage Stock - NO

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  421
Joined:  2008-07-11
New Haven, CT
 

I’ve seen this posted so many times today, I made a blog post about it rasberry

http://www.getfido.net/blog/magento/how-to-fix-the-magento-out-of-stock-bug-version-11x.php

Let me know if you have any issues following this! I’m setting it to notify me if you respond here.

 Signature 

@ My Magento Blog

- Handy tutorials on programming and designing Magento. A continual work in progress!
- Now with a new design, new hosting and a new domain! Check it out!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

@ nikefido
SOLVED! THANK YOU so much! i really appreciate everyone’s help. I’m sure you helped not only myself but many others with the same/similar problem. That’s what i love about the Magento Community they are a helpful group of people! By the way nikefido cool blog ill be sure to get your rss feed.

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  421
Joined:  2008-07-11
New Haven, CT
 
jvalen - 05 September 2008 12:15 PM

@ nikefido
SOLVED! THANK YOU so much! i really appreciate everyone’s help. I’m sure you helped not only myself but many others with the same/similar problem. That’s what i love about the Magento Community they are a helpful group of people! By the way nikefido cool blog ill be sure to get your rss feed.

Much appreciated :D The top Feed button (big one on the top) goes through addthis.com - the “real” feed is the link at the very bottom if you prefer to avoid it.

 Signature 

@ My Magento Blog

- Handy tutorials on programming and designing Magento. A continual work in progress!
- Now with a new design, new hosting and a new domain! Check it out!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

Ok one last thing. I remember seeing this in a post but cant seem to locate it. I know you can edit how many products you show up on the front page. Right now i have only 5 showing up. Does any one know where the file is i need to edit in order to change the amount of products i can view?

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  421
Joined:  2008-07-11
New Haven, CT
 

If you are referencing the “new” products still, you can edit this via the template file (phtml file).

app/design/frontend/*/*/template/catalog/product/new.phtml

You will fine (line 27 on my file):

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

This will control the looping code that shows each product. It keeps going until $i is greater than 5. (Which means it will show up to 6 products, because $i starts at zero).

You can change this number to any amount of products. (Just remember that any number n you choose, you need to change 5 to n - 1

 Signature 

@ My Magento Blog

- Handy tutorials on programming and designing Magento. A continual work in progress!
- Now with a new design, new hosting and a new domain! Check it out!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  54
Joined:  2007-12-12
Los Angeles
 

@ nikefido
If i understand correctly if i put the code

<?php if ($i>21 1): continue; endif; ?>
It will display 20 products? I tried that code and also
<?php if ($i>20): continue; endif; ?>
But its still displaying 5 products.

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendan.
Sr. Member
 
Total Posts:  181
Joined:  2008-07-16
Sydney, Australia
 

hi,

good to see you got it sorted!.
Ok you might have to modfiy the new.php file

go to

/app/code/core/mage/catalog/product/block/product/new.php

look around line: 53

$products->setOrder('news_from_date')->setPageSize(5)->setCurPage(1);

chenge to

$products->setOrder('news_from_date')->setPageSize(20)->setCurPage(1);

This sets the size of the records to be returned

Another tip

You might want to randomize the results set. Do do this you add some new code . see below

$products->getSelect()->order('rand()');

put this code before the following

$this->setProductCollection($products);

One final thing, the above example is done against the core files. This is not advisable if you plan on upgrading in the future. You can put this code into a custom local module class that is out of the upgrade path. Again, there is a wiki on creating your own modules/classes

enjoy!
Brendan

 Signature 

magento 1.1.6
PHP Version 5.2.6
http://www.getstuff.com.au

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  421
Joined:  2008-07-11
New Haven, CT
 

ah ha! enlightening. ty.

 Signature 

@ My Magento Blog

- Handy tutorials on programming and designing Magento. A continual work in progress!
- Now with a new design, new hosting and a new domain! Check it out!

 
Magento Community Magento Community
Magento Community
Magento Community
 
xgabo
Member
 
Total Posts:  38
Joined:  2008-09-11
 

My front page is now showing new and recentrly viewed products.  How do I keep it from showing recently viewed?  And since you said this is core code, wont our work get erased at the next update?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xgabo
Member
 
Total Posts:  38
Joined:  2008-09-11
 

Is there a way to make the new products wrap into another column with something like rows of 4

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 3
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52167 users|924 users currently online|105383 forum posts