Hack for mass update products timestamp changes magento


We found that during ‘Mass Update Products’ on admin side the updated timestamp of latest updated product not updated.(As per the magento functionality)

Tested in 1.5.1.0


<?php
<pre>app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php
 
find function saveAction(): 
find parameter.
$this->_getSession()->addNotice(
 

public function saveAction()
{
 ...
 $this->_getSession()->addNotice(
 $this->__('Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> <a href="%s">Index Management</a>', $this->getUrl('adminhtml/process/list'))
 );
 }
 ...
 
 
 //Added hack to set update timestamp of products in MASS EDIT products starts
 Mage::log("Mass Update Products : ".$this->_getHelper()->getProductIds());
 $pk_product_ids = $this->_getHelper()->getProductIds();
 $curr_date = date("Y-m-d H:i:s");
 foreach($pk_product_ids as $product_id){
  $product = Mage::getModel('catalog/product')->load($product_id);
  $productInfoData = $product->getData();
  $productInfoData['updated_at'] = $curr_date;
  $product->setData($productInfoData);
  $product->save();
  Mage::log('<br />'.$product_id .' Updated');
 }
 //Added hack to set update timestamp of products in MASS EDIT products ends
 
 
 .....
 
 
}</pre>
?>

Share on Facebook




About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools