开发者

Magento backend - make the price field readonly

开发者 https://www.devze.com 2023-02-06 09:54 出处:网络
I want to make the price text field开发者_运维技巧 in magento backend readonly because I use another custom attributes to fix prices.

I want to make the price text field开发者_运维技巧 in magento backend readonly because I use another custom attributes to fix prices.

How can I do that ?

Thanks a lot.


You need create an observer for catalog_product_load_after with the code like this:

$product->setLockedAttributes(array('price'));

And your product edit form will have readonly price field.


Since this would make attributes very silly, I don't believe that there is any simple mechanism by which to do this. One easy hack that you could use for this would be to add a JS file to that page which disables the price field specifically. Use the XML layout files for the default adminhtml package to add that JS file.

Hope that helps!

Thanks, Joe

0

精彩评论

暂无评论...
验证码 换一张
取 消