cancel
Showing results for 
Search instead for 
Did you mean: 

1.9.x custom attribute in the inventory tab

1.9.x custom attribute in the inventory tab

Dear community,

 

I am programatically creating an attribute and trying to add it to the inventory tab via:

$installer  = new Mage_Eav_Model_Entity_Setup('core_setup'); 
$installer->startSetup();
$installer->addAttribute('catalog_product', 'stock_reason', array(
            'group'           => 'Inventory',
            'label'           => 'Change Reason',
            'input'           => 'select',
            'type'            => 'int',
            'required'        => 0,
            'visible_on_front'=> 0,
            'filterable'      => 0,
            'searchable'      => 0,
            'comparable'      => 0,
            'user_defined'    => 1,
            'is_configurable' => 0,
            'global'          => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
            'note'            => '',
            'option' => 
  array (
    'values' => 
    array (
      0 => 'Incorrect Stock Level',
      1 => 'Received Stock',
      2 => 'Returned Stock',
      3 => 'Customer Cancelled',
      4 => 'Internal Usage',
    ),
  ),
));
$installer->endSetup();

However, the attribute gets added to a new tab also called inventory:

 https://pasteboard.co/HRIIlIV.png

 

Apparently, you cannot add the attribute in the inventory group in this way. So, how would I add this attribute I have created to the inventory tab? 

1 REPLY 1

Re: 1.9.x custom attribute in the inventory tab

Hi vpatel93,

 

You need to add manually the attribute in app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml template.

 

Best Regards,