更新时间:2023-11-29 22:19:52
好吧,看来还是可以的.在为catalog_product_load_after
事件添加观察者后,可以使用Mage_Catalog_Model_Abstract
类的lockAttribute
方法将产品属性设为只读.下面是观察者方法的代码:
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');
}