Magento read-only and hidden product attributes

后端 未结 7 1332
迷失自我
迷失自我 2020-12-16 14:10

I would like to have some Magento product attributes that are not editable from the admin interface and some that are not visible at all in that interface (as a method of st

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 15:07

    OK, it looks like it can be done after all. After adding an observer for the catalog_product_load_after event, the lockAttribute method of the Mage_Catalog_Model_Abstract class may be used to make a product attribute read-only. Here is the code for the observer method:

    public function lockAttributes($observer) {
        $event = $observer->getEvent();
        $product = $event->getProduct();
        $product->lockAttribute('attribute_code');
    }
    

提交回复
热议问题