Magento backend - make the price field readonly

≯℡__Kan透↙ 提交于 2019-12-14 03:44:30

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/4793596/magento-backend-make-the-price-field-readonly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!