Search code examples
phpmagentomoduleattributesadmin

Magento addAttribute to a specific product tab (admin)


Is it possible to use the addAttribute function to add an attribute directly to a specific product new & edit tab? For example the price tab?


Solution

  • Sure, just specify the tab by attribute 'group':

    $installer->addAttribute('catalog_product', 'my_custom_product_attr',
        array(
            ...
            'group' => 'Tab XY',
            ...
        ));
    

    You may also want to order your attribute inside the tab. You can do this by specifying the attribute position:

    $installer->addAttribute('catalog_product', 'my_custom_product_attr',
        array(
            ...
            'group' => 'Tab XY',
            'position' => Z
            ...
        ));