How to Hide a Field on a Product Edit Page in Magento Backend Using Observer

Apr 8, 2016600
How to Hide a Field on a Product Edit Page in Magento Backend Using Observer

There is a specific set of fields that are displayed by default on the product settings page. However, there can be certain conditions when the fields should not be displayed, for instance: Minimum Sell Price attribute should be editable for the Admin access level users, but others should have no access to this field.

How to Hide a Field on a Product Edit Page in Magento backend Using Observer

Add a new event to config.xml  core_block_abstract_prepare_layout_befor

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor

Then add the following code to Observer.php

As a result the field Minimum Sell Price will not be displayed on the product settings page.


Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor
Tags:

4 Comments

  1. How to achieve same in magento 2 ? I have tried, but not getting the exact event in which we can capture the attributes and unset them.

  2. Prajakta,
    Thank you for this question!
    We will do our best to answer it in our future articles.

  3. Hi! I need help hiding an attribute from configurable product in admin, but I want it to be visible in simple products.
    Also, I don’t know to which files you are referring to in the tutorial. Sorry! I’m a Magento newbie.
    Thank you!

  4. Hi Johann,
    You can add a new condition $block->getProduct()->getTypeId() == ‘configurable’ and then hide an attribute.

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *