Set Update Time in Custom module on Grid
-
05-10-2020 - |
Pregunta
I am Created one Custom Module called : Sigmasolve/Recipe.
But Problem is that on Grid Page only Display Updated Time
Column But not Display any Data in That Column. And also in Database only create column like updated_time
but not store any "data" in that Field.
I am Using Magento Version:1.9.2.3 .
Any Kind of help will appreciated.
Solución
To save updated_time
from your controller use this-
if you want to save current time
$yourModelCollection->setUpdatedTime(Varien_Date::now())->save();
Or if you want to save any particular date then
$yourModelCollection->setUpdatedTime('your_date')->save();
Otros consejos
Add following function in your Sigmasolve/Recipe model file.
public function beforeSave()
{
parent::beforeSave();
$this->setUpdatedTime(Mage::getModel('core/date')->date('Y-m-d h:m:s'));
return $this;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange