Magento - Add field to actions in Catalog Price Rules

Magento - Add field to actions in Catalog Price Rules

September 13, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Add field to actions in Catalog Price Rules

Solving Magento Development Issues: Adding Custom Fields to Catalog Price Rules

Introduction

As experienced Magento developers, we often encounter challenges when customizing the platform’s out-of-the-box functionality. One such issue is adding new fields to existing sections of the admin panel. Let’s explore a common problem faced by users trying to add a field to the “Actions” tab in the Catalog Price Rules section and provide a step-by-step solution.

The Problem: Custom Field Not Saving

A user attempted to add a custom field named “Custom Field” to the “Actions” tab of the Catalog Price Rules. After following several steps, including modifying core files and creating an upgrade script, they found that the changes made in this new field were not being saved to the database.

This issue occurs because Magento’s catalog rule setup process does not automatically recognize new fields added through code modifications. To resolve this, we need to ensure that the database schema is updated correctly during the installation or upgrade process.

The Solution: Updating the Database Schema

To fix the problem of the custom field not being saved, follow these steps:

  1. Update the version number: Open the app\code\core\Mage\CatalogRule\etc\config.xml file and modify the <version> tag to reflect the latest version (e.g., 1.6.0.4):
<Mage_CatalogRule>
    <version>1.6.0.4</version>
</Mage_CatalogRule>
  1. Create an upgrade script: Generate a new file named app\code\core\Mage\CatalogRule\sql\catalogrule_setup\upgrade-1.6.0.3-1.6.0.4.php and add the following code:
$installer = $this;
$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();
  1. Reindex and clear cache: After updating the files and creating the upgrade script, reindex all indexes and clear the Magento cache from the admin panel:
  • Go to System > Index Management and click “Reindex All”
  • Navigate to System > Cache Management and click “Flush Cache Storage”

Conclusion

Adding custom fields to Magento’s admin panel requires careful modification of core files and proper database schema updates. By following the steps outlined above, you can successfully add a new field to the “Actions” tab in the Catalog Price Rules section and ensure that the changes are saved correctly.

Remember that modifying core files should be done with caution, as it may introduce conflicts during future upgrades or could be overwritten by subsequent Magento versions. Whenever possible, consider using custom modules or extensions to customize the platform’s functionality without touching the core files directly.

For more advanced customizations and best practices in Magento development, feel free to explore our comprehensive guides at Laravel Company. We provide expert insights on various aspects of Magento development, ensuring you can build robust and efficient e-commerce solutions.

Catalog Database Admin Configuration

Our network