Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Page 1 of 2
Want to show more than 5 “New Products” to the home page ? 
 
Ssendol
Jr. Member
 
Total Posts:  3
Joined:  2008-07-25
 

If someone want to show more than 5 new product in home page.
Try This…
This example to show 10 items in 2 rows 5 products each.

You need to change the line in \app\code\core\Mage\Catalog\Block\Product\New.php
$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);
change to
$products->setOrder(’news_from_date’)->setPageSize(10)->setCurPage(1);

Andneed to change new.phtml
<?php if ($i>5): continue; endif; ?>
change to
<?php if ($i==5):  echo "</tr><tr>"; endif; ?>
<?php if ($i>9): continue; endif; ?>

Good luck....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Albert van der Veen
Jr. Member
 
Total Posts:  15
Joined:  2008-05-30
Amsterdam
 

(replying to different threads with this info)
Update on this for version 1.1.8 (and probably higher but untested):

You can use an action in the layout template to set the number of new products displayed. Find the layout xml file that has a block of type catalog/product_new, this displays the new products. Next add an action with method setProductsCount as follows (I use the new products block in a cms page):

<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms.top">
<action method="setProductsCount"><count>10</count></action>
</block>

This shows a maximum of 10 items. You also have to change the template catalog/product/new.phtml, because that has a default of 5 in it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jvalen
Member
 
Avatar
Total Posts:  68
Joined:  2007-12-12
Los Angeles
 
Ssendol - 28 August 2008 11:32 PM

If someone want to show more than 5 new product in home page.
Try This…
This example to show 10 items in 2 rows 5 products each.

You need to change the line in \app\code\core\Mage\Catalog\Block\Product\New.php
$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);
change to
$products->setOrder(’news_from_date’)->setPageSize(10)->setCurPage(1);

Andneed to change new.phtml
<?php if ($i>5): continue; endif; ?>
change to
<?php if ($i==5):  echo "</tr><tr>"; endif; ?>
<?php if ($i>9): continue; endif; ?>

Good luck....

Do you know of any way of adding more rows? maybe 3 or 4 rows.

 Signature 

Converting to Magento
BarbieIsOut

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

Anyone have any suggestions on how to add more rows? i want to display about 15 or 20 products on the Home page.

 Signature 

Converting to Magento
BarbieIsOut

 
Magento Community Magento Community
Magento Community
Magento Community
 
blueben
Guru
 
Avatar
Total Posts:  446
Joined:  2008-10-09
Charleston, SC
 

Look at list.phtml, grid mode code.  You have to loop through a certain number of cells, and after 5, draw a new table row.

 Signature 

Benjamin MarksBlue AcorneCommerce Consulting
Magento Professional Partner

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  70
Joined:  2008-12-06
Bucuresti - Romania
 

I’ve put a post here.
It worked for me, hope that helps.

 Signature 

Genti/Rucsaci.ro - Genti, Rucsaci Huse ... Toate intr-un singur loc
Bio-bazar.ro - Cosmetice bio, 100% naturale

 
Magento Community Magento Community
Magento Community
Magento Community
 
usauggs
Jr. Member
 
Total Posts:  26
Joined:  2009-08-23
 

Hi,

I tried what Albert van der Veen told us. It works and it’s so fast and easy. Thanks.

 Signature 

No need to change the world, grow up, man!

my sample site: cheap jerseys,cheap uggs

 
Magento Community Magento Community
Magento Community
Magento Community
 
reaktion
Member
 
Total Posts:  48
Joined:  2009-02-16
 
Albert van der Veen - 16 January 2009 06:02 AM

(replying to different threads with this info)
Update on this for version 1.1.8 (and probably higher but untested):

You can use an action in the layout template to set the number of new products displayed. Find the layout xml file that has a block of type catalog/product_new, this displays the new products. Next add an action with method setProductsCount as follows (I use the new products block in a cms page):

<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms.top">
<action method="setProductsCount"><count>10</count></action>
</block>

This shows a maximum of 10 items. You also have to change the template catalog/product/new.phtml, because that has a default of 5 in it.

Which layout file contains a block of type catalog/product_new ?

I can’t find it anywhere!

 
Magento Community Magento Community
Magento Community
Magento Community
 
CajuCLC
Guru
 
Total Posts:  666
Joined:  2008-09-28
 

I do this:

<reference name="content">
  <
block type="catalog/product_new" name="home.new" alias="product_new" template="catalog/product/new.phtml">
    <
action method="setProductsCount"><count>8</count></action>
    <
action method="addPriceBlockType">
      <
type>bundle</type>
      <
block>bundle/catalog_product_price</block>
      <
template>bundle/catalog/product/price.phtml</template>
    </
action>
  </
block>
</
reference>

<action method="setProductsCount"><count>8</count></action>

That sets how many products.

 Signature 

Dúvidas sobre o Magento?
Acesse MagentoBR e tire suas dúvidas. Temos tutoriais, módulos, etc!
Hospedo meus sites na DreamHost.
Clique aqui e use o code MAGENTOBR40 para ter $40,00 de desconto na hospedagem!
Clique aqui e use o code MAGENTOBRIP para receber 1 IP free mais $10,00 de desconto na hospedagem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  344
Joined:  2008-11-14
Spain
 
jvalen - 30 January 2009 10:26 AM

Anyone have any suggestions on how to add more rows? i want to display about 15 or 20 products on the Home page.

In Magento Admin:

<action method="setProductsCount"><count>20</count></action>

In app/design/frontend/default/default/template/catalog/product/new.phtml (adapt it to your needs):

<?php $i=0; foreach ($_products->getItems() as $_product): ?>
            <?php 
if ($i>=20): continue; endif; ?>
        
            
<td>
                <
class="product-image">
                    <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(170) ?>" width="170" height="170" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
                </
p>
                <
p><class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
                
<?php echo $this->getReviewsSummaryHtml($_product'short'?>
                <?php 
echo $this->getPriceHtml($_producttrue'-new'?>
                <?php 
if($_product->isSaleable()): ?>
                    
<a href="<?php echo $this->getAddToCartUrl($_product) ?>"><img src="<?php echo $this->getSkinUrl('images/btn_add_to_cart.gif') ?>" alt="<?php echo $this->__('Add to Cart') ?>" title="<?php echo $this->__('Add to Cart') ?>" /></a>
                
<?php else: ?>
                
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
                
<?php endif; ?>
                
<div class="clear"></div>
                <
ul class="add-to">
                    
<?php if ($this->helper('wishlist')->isAllow()) : ?>
                        
<li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist'?></a></li>
                    
<?php endif; ?>
                    <?php 
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                        
<li><a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare'?></a></li>
                    
<?php endif; ?>
                
</ul>
                </
td>
        
<?php $i++; 
        if (
$i%== 0{
            
echo "</tr><tr>";
            
}
        
endforeach; ?>

 Signature 

amartinez {web/developer/designer} free modules: CustomImportExport Like it? Donate!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sneako
Member
 
Total Posts:  47
Joined:  2009-12-05
 

this message is blank smile

 Signature 

--------------------

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ruurd
Jr. Member
 
Total Posts:  8
Joined:  2010-02-15
 

If you want to add the new products-block in a CMS page/block you can use:

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml" _productsCount="10"}}

with _productsCount="0" the list will have no limit

 
Magento Community Magento Community
Magento Community
Magento Community
 
2jdesign
Jr. Member
 
Total Posts:  18
Joined:  2010-03-05
Sheffield, UK
 

Great post was very helpful thanks

 Signature 

2J Design Ltd
Ecommerce Web Design
Magento Ecommerce Specialists | Web Designer | Magento Developer

 
Magento Community Magento Community
Magento Community
Magento Community
 
smileindia
Jr. Member
 
Total Posts:  5
Joined:  2010-12-13
 
Ssendol - 28 August 2008 11:32 PM

If someone want to show more than 5 new product in home page.
Try This…
This example to show 10 items in 2 rows 5 products each.

You need to change the line in \app\code\core\Mage\Catalog\Block\Product\New.php
$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);
change to
$products->setOrder(’news_from_date’)->setPageSize(10)->setCurPage(1);

Andneed to change new.phtml
<?php if ($i>5): continue; endif; ?>
change to
<?php if ($i==5):  echo "</tr><tr>"; endif; ?>
<?php if ($i>9): continue; endif; ?>

Good luck....

it worked like a charm ...thanks mate

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ed Baxter
Member
 
Avatar
Total Posts:  53
Joined:  2009-05-27
 

Thanks for sharing! Will be using this in future projects!

 Signature 

Ed Baxter
SEO Manager & Magento Developer - Magento Training Videos

My Network:
Wall Clocks
SEO Sheffield Blog

 
Magento Community Magento Community
Magento Community
Magento Community
 
freshshop
Sr. Member
 
Total Posts:  83
Joined:  2009-03-07
 
cristache - 08 February 2009 08:34 AM

I’ve put a post here.
It worked for me, hope that helps.

I use version 1.3.2 and this worked like a charm. Thanks cristache!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
© Copyright Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
819302 users|802 users currently online|519717 forum posts