问题
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