I'm having trouble trying to create new options in the "Manage Options" tab. When I create an attribute, I already know how to save the data correctly in the database. I'm replacing Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
with my module to create custom fields.
My module:
config.xml
<config>
<blocks>
<adminhtml>
<rewrite>
<catalog_product_attribute_edit_tabs>Ceicom_Swatches_Block_Adminhtml_Tabs</catalog_product_attribute_edit_tabs>
<catalog_product_attribute_edit_tab_options>Ceicom_Swatches_Block_Adminhtml_Options</catalog_product_attribute_edit_tab_options>
</rewrite>
</adminhtml>
</blocks>
</config>
Ceicom / Swatches / Block / Adminhtml / Options.php
class Ceicom_Swatches_Block_Adminhtml_Options extends Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
{
public function __construct()
{
parent::__construct();
$this->setTemplate('ceicom/attribute/options.phtml');
}
}
In the phtml file I put in the custom fields:
By all means to do this need to be added new columns in the eav_attribute_option
table. For example, campo_1
, campo_2
.
To save the additional fields I need to rewrite Mage_Eav_Model_Resource_Entity_Attribute::_saveOption()
.
How do I do this without changing the core, just as I did above using rewrite
, and how do I load the database data for the inputs when editing the attribute?