I want to add a custom field to the actions tab in the Catalog Price Rules section.
This is what I did:
I added these lines to the file app\code\core\Mage\Adminhtml\Block\Promo\Catalog\Edit\Tab\Actions.php
$fieldset->addField('custom_field', 'select', array( 'label' => 'Custom Field', 'title' => 'Custom Field', 'name' => 'custom_field', 'options' => array( '1' => Mage::helper('catalogrule')->__('Yes'), '0' => Mage::helper('catalogrule')->__('No'), ), ));
I changed the version to 1.6.0.4 in this file: app\code\core\Mage\CatalogRule\etc\config.xml
<Mage_CatalogRule> <version>1.6.0.4</version> </Mage_CatalogRule>
- I created new file with the name app\code\core\Mage\CatalogRule\sql\catalogrule_setup\upgrade-1.6.0.3-1.6.0.4.php
$installer->startSetup(); $ruleProductTable = $installer->getTable('catalogrule/rule'); $columnOptions = array( 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, 'UNSIGNED' => true, 'NULLABLE' => false, 'DEFAULT' => 0, 'COMMENT' => 'Custom Field', ); $installer->getConnection()->addColumn($ruleProductTable, 'custom_field', $columnOptions); $installer->endSetup();
Then, I logged in to the admin panel and tried to edit one of the catalog price rules.
I saw my new field in the actions tab - great!
But when I click "Save", the changes that I made in that field, was not saved.
I logged in to the phpmyadmin and went to catalogrule table. In this table I can see the new field custom_field, with the value 0 (default) - so It really didn't save the changed.
My question is what I did wrong? Why the changed in the custom_field didn't saved in the DB?
Thanks