I need to add the backend_model
value of an attribute where wasn't specified in the install setup script. The missing line is:
'backend' => 'eav/entity_attribute_backend_datetime'
But so far using just this line in an upgrade script
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
$installer->startSetup();
$installer->updateAttribute('catalog_product', 'custom_date', array(
'backend' => 'eav/entity_attribute_backend_datetime'));
$installer->endSetup();
Is not updating the column backend_model
in the ear_attribute table. So I'm forced to use
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
$installer->startSetup();
$installer->removeAttribute('catalog_product','custom_date');
$installer->addAttribute('catalog_product', 'custom_date', array(
'label' => 'Launches - Release Date',
'type' => 'datetime',
'input' => 'date',
'class' => 'validate-date',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'used_in_product_listing' => true,
'backend' => 'eav/entity_attribute_backend_datetime'
));
$installer->endSetup();
Any idea if is actually possible to update the backend_model
in an upgrade script.
Best Answer
I've found the solution replacing backend to backend_model but looks like a bug of Magento.