Show product creation & last edit dates on Frontend in Magento


I've seen the two attributes in the MySQL database at table catalog_product_entity

the fields are 'created_at' and 'updated_at'

How do I get them to show up on frontend?

5/26/2009 7:53:09 PM

Accepted Answer

The attributed can simply be added using the getAttributeName() function, for instance, to get created_at, just add the following php script to the phtml page:

<?php echo $_product->getCreatedAt();?>

For updated_at, use:

<?php echo $_product->getUpdatedAt();?>
5/27/2009 10:01:58 AM

If you are showing these two things in listing page, probably they will not be displayed. Instead use following code:

For Created

<?php echo Mage::getModel('catalog/product')->load($_product->getId())->getCreatedAt();?>

For Updated:

<?php Mage::getModel('catalog/product')->load($_product->getId())->getUpdatedAt();?>

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow