1

I have created a new product type that doesn't need a price attribute so I would like to hide the tab in the backend in a similar way as Grouped product are.

How can I accomplish this ?

  • This is by predefine attributes in Magento you can not delete and change this attribute. so u can not do this – Keyul Shah Apr 22 '15 at 8:41
  • I found out the solution thx – Fra Apr 22 '15 at 8:47
1

The attribute tabs are displayed only if the group tab contains any attribute.

see Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs::_prepareLayout()

if (count($attributes)==0) {
                    continue;
                }

So there is nothing special here: if you look at the prices attribute you will see they are not assigned to the grouped products that is why the tab is not displayed.

You can change the apply_to values of any of the product attributes in 2 way: manually or using an installer script.

Example installer script:

<?php
$installer = $this;
$installer->startSetup();

$price_attributes = array(
    'group_price',
    'msrp_display_actual_price_type',
    'price',
    'special_price',
    'tier_price',
    'msrp_enabled',
    'msrp',
);

foreach ($price_attributes as $attribute_code) {
    $installer->updateAttribute('catalog_product', $attribute_code, 'apply_to', 'simple,configurable,virtual');
}

$installer->endSetup();

Note:
This will also have impact on frontend so you need to modify price.html and price index according to your needs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.