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
精彩评论