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 ?
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 ?
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