- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2018
09:40 AM
12-14-2018
09:40 AM
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?
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018
06:05 AM
12-18-2018
06:05 AM
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,