Adding Custom Fields to Magento Bundle Products
Welcome developers! Today we’re going to tackle a common question that often arises when working with Magento: how to add custom fields to the bundle item creation process.
Understanding the Default Bundle Product Creation Process
Before we dive into adding new fields, let’s first understand the default flow for creating a new bundle product. When you go to Catalog > Products, and click on Add New Product or edit an existing one, select Bundle Product. You’ll see the following screen:

By default, you can only add a title for each bundle item. However, what if you want to add additional information like a description?
Adding a Custom Text Field
To accomplish this, we’ll need to modify the core module code directly. It’s important to note that changing core files should always be done with caution, as it may cause issues during updates. As a best practice, consider making your changes in an override or using third-party extensions for this purpose.
-
Navigate to the
app/code/core/Mage/Bundle/sql/bundle_setup/install-0.7.2.sqlfile. -
Look for the table creation statement for
catalog_product_entity_varchar. It will look something like this:
CREATE TABLE {$table_prefix}catalog_product_entity_varchar (
entity_id int(11) unsigned NOT NULL auto_increment COMMENT 'Entity ID',
attribute_id int(11) unsigned DEFAULT NULL,
store_id tinyint(3) unsigned DEFAULT NULL,
value varchar(255) DEFAULT NULL,
PRIMARY KEY (`entity_id`, `attribute_id`, `store_id`),
CONSTRAINT FOREIGN KEY (entity_id) REFERENCES catalog_product_entity (entity_id),
CONSTRAINT FOREIGN KEY (attribute_id) REFERENCES eav_attribute (attribute_id),
CONSTRAINT FOREIGN KEY (store_id) REFERENCES core_store_group (store_id)
) COMMENT='Product Varchar Attributes';
- Add the following line just above the
PRIMARY KEYdefinition:
bundle_item_description varchar(255) DEFAULT NULL,
Your table creation statement should now look like this:
CREATE TABLE {$table_prefix}catalog_product_entity_varchar (
entity_id int(11) unsigned NOT NULL auto_increment COMMENT 'Entity ID',
attribute_id int(11) unsigned DEFAULT NULL,
store_id tinyint(3) unsigned DEFAULT NULL,
value varchar(255) DEFAULT NULL,
bundle_item_description varchar(255) DEFAULT NULL,
PRIMARY KEY (`entity_id`, `attribute_id`, `store_id`),
CONSTRAINT FOREIGN KEY (entity_id) REFERENCES catalog_product_entity (entity_id),
CONSTRAINT FOREIGN KEY (attribute_id) REFERENCES eav_attribute (attribute_id),
CONSTRAINT FOREIGN KEY (store_id) REFERENCES core_store_group (store_id)
) COMMENT='Product Varchar Attributes';
- Save the file.
Creating the New Attribute
Now, let’s create the new attribute that corresponds to our custom field:
-
Navigate to System > Configuration > Catalog > Catalog > Products Attributes.
-
Click on Add New Attribute.
-
Fill out the fields as follows:
- Attribute Code:
bundle_item_description - Frontend Label: Bundle Item Description
- Input Type: Text Field
- Attribute Code:
-
Scroll down and set the following options:
- Scope: Global
- Used In Forms: Product Details, Product Attributes
- Visible On Catalog Pages On Frontend: No
- Used For Sorting in Search: No
-
Click on Save Attribute.
Conclusion
And there you have it! By following these steps, you’ve successfully added a new text field for the bundle item description directly below the default title.
Remember, modifying core files should be approached with care and thorough testing to ensure no conflicts arise during updates or changes in the future. It’s always a good idea to work with experienced developers when making such modifications.
If you find yourself needing more advanced customizations or have questions about other areas of Magento development, feel free to explore our blog at LaravelCompany, where we regularly publish articles on best practices and tips for working with this powerful e-commerce platform.