How can I extend the "Custom Options" in a configurable product? I need to add a new field named Identifier
. Where can I find the necessary templates?
I figured out that the template is in app\design\adminhtml\default\default\template\catalog\product\edit\options\option.phtml
, and I added my custom code to it:
But I have no clue to which table I have to add the new attribute "identifier" ?
How can I figure this out?
I thought I have to add it to the table Catalog_Product_Edit_Options_Option
because the template is in app\design\adminhtml\default\default\template\catalog\product\edit\options\option.phtml but this threw an error that the table could not be found.
How do I know the right table name where the attribute belongs to?
I tried to install it to the table catalog_product_option_type_value
with this install script but it is not the right table, because if I enter something and save something then it is not saved:
<?php
Mage::log("Add attribute 'identifier' to table 'catalog_product_edit_options_option'", 7, "system.log");
$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
$installer->getConnection()
->addColumn($installer->getTable('catalog_product_option_type_value'),
'identifier',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'input' => 'text',
'nullable' => true,
'default' => null,
'comment' => 'Identifier of the Option, used to perform specific actions in scripts only on options with certain identifiers.'
)
);
$installer->endSetup();
I also added it to the table catalog_product_option
but it still does not save.
Update: I noticed that the value is actually stored into the database, but magento fails to load it in the backend so it looks like it is empty. I used this query
SELECT * FROM `magecatalog_product_option` WHERE `option_id` = 443`
Why does it not show in the backend?