Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show product creation & last edit dates on Frontend in Magento

Tags:

php

mysql

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?

like image 614
segfault Avatar asked May 26 '09 10:05

segfault


2 Answers

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();?>
like image 150
segfault Avatar answered Nov 18 '22 21:11

segfault


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();?>
like image 40
Adarsh Khatri Avatar answered Nov 18 '22 20:11

Adarsh Khatri