2016-04-06 08:44
浏览 51


In Manage Products -> Edit a product -> Images I've added 2 new columns (which are located in the catalog_product_entity_media_gallery_value table).

Those 2 columns are filled every time there is a media import and each field only show the value (you can't enter a new value). It's also used on the frontend. I've modified in my own theme the correct admin template file and created a new product.js to display the 2 new fields. So far everything is working as intended.

But whenever a user tries to modify something in the Images section, let say the label of an image or the position, my 2 custom fields are not saved and Magento give them the NULL value.

Because the 2 new columns are not input fields, I thought Magento would not update it, but looks like it does. I've been trying to find where the label and position are saved for the Images section so that I can add my custom values but I can't find it. Could somebody point me in the right direction?

Or would it be better to listen to the catalog_product_save_after event and create an observer to save my custom values?

Any help would be great, thank you.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushou6480 2016-04-08 12:58

    Finally found it, I missed it during my previous searches. I'll answer it myself just in case it can help someone else. Code is in the Mage_Catalog_Model_Product_Attribute_Backend_Media class, inside the afterSave function. All you have to do is to rewrite it.

    Config.xml should contain the following :


    And class should be : Namespace_Module_Model_Product_Attribute_Backend_Media extends Mage_Catalog_Model_Product_Attribute_Backend_Media

    解决 无用
    打赏 举报

相关推荐 更多相似问题