Magento - Add field to actions in Catalog Price Rules -



Magento - Add field to actions in Catalog Price Rules -

i want add together custom field actions tab in catalog cost rules section.

this did:

i added these lines 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 version 1.6.0.4 in file: app\code\core\mage\catalogrule\etc\config.xml

<mage_catalogrule> <version>1.6.0.4</version> </mage_catalogrule> i created new file 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, logged in admin panel , tried edit 1 of catalog cost rules.

i saw new field in actions tab - great!

but when click "save", changes made in field, not saved.

i logged in phpmyadmin , went catalogrule table. in table can see new field custom_field, value 0 (default) - didn't save changed.

my question did wrong? why changed in custom_field didn't saved in db?

thanks

i'm not sure why isn't working guess installer isn't beingness called. managed modification through module , local edits future proof change.

directory structure:

/app/code/local/custom/promo /app/code/local/custom/promo/etc/ /app/code/local/custom/promo/sql /app/code/local/custom/promo/sql/promo_setup /app/code/core/local/adminhtml/block/promo/catalog/edit/tab

add file /app/code/local/custom/promo/etc/config.xml

<?xml version="1.0"?> <config> <modules> <custom_promo> <version>1.0</version> </custom_promo> </modules> <global> <resources> <promo_setup> <setup> <module>custom_promo</module> <class>mage_catalog_model_resource_setup</class> </setup> </promo_setup> </resources> </global> </config>

add file /app/code/local/custom/promo/sql/promo_setup/install-1-0.php

/* @var $installer mage_core_model_resource_setup */ $installer = $this; $installer->startsetup(); $ruleproducttable = $installer->gettable('catalogrule/rule'); $columnoptions = array( 'type' => varien_db_ddl_table::type_boolean, 'nullable' => false, 'comment' => 'custom promo', ); $installer->getconnection()->addcolumn($ruleproducttable, 'custom_promo', $columnoptions); $installer->endsetup();

clear caches , verify column added looking @ catalog_rule table

select * catalogrule;

finally take re-create of /app/code/core/mage/adminhtml/block/promo/catalog/edit/tab/main.php , create same file /app/code/core/local/adminhtml/block/promo/catalog/edit/tab/main.php

edit file , add together field before $form->setvalues($model->getdata());

//custom promo $fieldset->addfield('custom_promo', 'select', array( 'label' => 'custom promo', 'title' => 'custom promo', 'name' => 'custom_promo', 'options' => array( '1' => mage::helper('catalogrule')->__('yes'), '0' => mage::helper('catalogrule')->__('no'), ), ));

magento magento-1.9

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -