Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Displaying new products on homepage does not work properly
 
kabuto
Jr. Member
 
Total Posts:  18
Joined:  2008-02-25
 

How can I make this work properly
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}

There is products showing, but…
It just shows the same five products no matter what I do. I have added new products, set new from and to date but it does not show up. It is the same five products that show no matter what I do. The five products seems to be randomly picked, I can not find anywhere what makes them show up in this order. It is not by “Set Product as New from Date<” or “Set Product as New to Date”

could it be the date formatting that screws it up?
doesn’t it work with nested categories?
caching?

Did someone make it work ok not using US locale settings and nested categories at least 3 categories deep?

Can someone please help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
themobilephonesite
Jr. Member
 
Total Posts:  25
Joined:  2008-08-11
 

Hi,

I am having the same problem. It works fine but only shows first 5 products.

please does anyone know the answer.

here is the code being used

<br>
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="home-page-cntr">
<h3>Popular Products</h3>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
<?php if ($i>6): continue; endif; ?>

<div class="home-page-item<?php if ($i==2 || $i==6): echo "1"; endif; ?>">
<div class="home-page-img">
<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(110,110); ?>” alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
<?php echo $_product->getName() ?></a>
</div>
</div>
<?php $i++; endforeach; ?>
<?php for($i;$i%7!=0;$i++): ?>
<?php endfor ?>
</div>
<?php endif; ?>[/code

Thank you ]

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabuto
Jr. Member
 
Total Posts:  18
Joined:  2008-02-25
 

I had dabbled with app/code/core/Mage/Catalog/Block/Product/New.php
to get this thing working in the beginning. I commented out one line and now it works as supposed to, except that it also shows products that is out of stock.

$product    Mage::getModel('catalog/product');
        
/* @var $product Mage_Catalog_Model_Product */
        
$todayDate  $product->getResource()->formatDate(time());
        
$products   $product->setStoreId($storeId)->getCollection()
//            ->addAttributeToFilter('news_from_date', array('date'=>true, 'to'=> $todayDate))
            
->addAttributeToFilter(array(array('attribute'=>'news_to_date''date'=>true'from'=>$todayDate), array('attribute'=>'news_to_date''is' => new Zend_Db_Expr('null'))),'','left')
            ->
addAttributeToSort('news_from_date','desc')
            ->
addAttributeToSelect(array('name''price''small_image'), 'inner')
            ->
addAttributeToSelect(array('special_price''special_from_date''special_to_date'), 'left')
            ->
addAttributeToSelect('status')
        ;

I know it is core and shouldn’t be modified, but I tried to make it work so many hours (I’m not a programmer) following all guides here and probably mixing them together.  At least now it works grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
QuattroPorte
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-03-08
 
themobilephonesite - 08 October 2008 10:41 AM

Hi,

I am having the same problem. It works fine but only shows first 5 products.

please does anyone know the answer.

here is the code being used

<br>
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="home-page-cntr">
<h3>Popular Products</h3>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
<?php if ($i>6): continue; endif; ?>

<div class="home-page-item<?php if ($i==2 || $i==6): echo "1"; endif; ?>">
<div class="home-page-img">
<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(110,110); ?>” alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
<?php echo $_product->getName() ?></a>
</div>
</div>
<?php $i++; endforeach; ?>
<?php for($i;$i%7!=0;$i++): ?>
<?php endfor ?>
</div>
<?php endif; ?>[/code

Thank you ]

I solved this problem by hacking app/code/core/Mage/Catalog/Block/Product/New.php as follows:
line 54
$products->setOrder(’news_from_date’)->setPageSize(5)->setCurPage(1);
change to e.g.
$products->setOrder(’news_from_date’)->setPageSize(50)->setCurPage(1);
after that set you own display limit via $i>n in the foreach loop.

 
Magento Community Magento Community
Magento Community
Magento Community
 
screege
Sr. Member
 
Total Posts:  107
Joined:  2008-05-08
 

Has anyone done to display only 5 products per row, I have changed the code but it displays the items on the same row and gets behind my right bar content.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Johan05
Member
 
Total Posts:  64
Joined:  2008-06-24
 

Hello everybody,

“Set Product as New to Date” function’s doesn’t run in my store. After the limit of the date, the product is also visible ! Have you got a answer to this “bug” ?
Thank you !

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabuto
Jr. Member
 
Total Posts:  18
Joined:  2008-02-25
 

I’m bumping this again since it still doesn’t work!

Getting really frustrated with this, now my old fix just write over the “New.php” with my older working file doesn’t work at all.

Besides adding the dates, what else am I supposed to do to make this work?

Set Product as New from Date
Set Product as New to Date

Just wants to display the five latest products on the front page :-(

 
Magento Community Magento Community
Magento Community
Magento Community
 
guillaume7684
Sr. Member
 
Total Posts:  241
Joined:  2008-10-20
 
screege - 15 November 2008 06:13 AM

Has anyone done to display only 5 products per row, I have changed the code but it displays the items on the same row and gets behind my right bar content.

Hello,

I have the same problem.
Did you find a solution?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top