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

use $_product->getCreatedAt() on list.phtml, or more simply, display product creation date on listing pages. 
 
tonegolf71
Jr. Member
 
Total Posts:  21
Joined:  2008-10-14
 

Hi,

I’m looking to get the date a product was added and use it on listing pages (via /template/catalog/view.phtml).

I can successfully use the $_product->getCreatedAt() function on the product page itself, but it does not work on the listing pages.

I was hoping as I am using the flat catalog that it would just be a case of configuring the relevant attribute setting of “Used in Product Listing” to Yes. But the Created At field is not stored as a normal product attribute it seems.

Therefore I assume I need to add a function to pull this out in the /code/..../Catalog/Block/Product/View.php

The trouble is I’m not sure how to write in grin

Anyone out there who can help me?

Thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tonegolf71
Jr. Member
 
Total Posts:  21
Joined:  2008-10-14
 

no one got any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeroyWhite
Member
 
Total Posts:  36
Joined:  2009-02-25
 

I know this is an old post, but for anyone still looking for an answer, the following works on v 1.7…

echo $this->formatDate($_product[\'created_at\']);
 
Magento Community Magento Community
Magento Community
Magento Community
 
nimit8989
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2012-02-21
 

Thanks LeroyWhite,

From this i tried for

echo $this->formatDate($_product[\’updated_at\’]);

and this too worked in magento-1.7.0.2

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