My aim is to create the product's New From and New To date fields to be filled automatically, We do not have to fill those dates. So basically i want the New From Date should be the same when product is being edited/added and In the field New to date, i want to automatically assign the date after 3 month's date.

1 Answer 1


you need to create an observer for the event catalog_product_save_before that can look like this:

public function setNewDates($observer) 
    $dateModel = Mage::getSingleton('core/date');
    $product = $observer->getProduct();
    $product->setNewsToDate($dateModel->gmtDate(null, mktime(0,0,0, date('m') + 3, date('d'), date('Y') )));
    return $this;
  • Thanks Marius, It worked for me. I have used this event 'catalog_product_prepare_save' .
    – K T
    May 20, 2015 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.