First of all, we have to create a module for adding custom category attribute.
Step 1. Create a new module.
We should let Magento know about our new module. The initial configuration file is located at ‘app/etc/modules/Namespace_Modulename.xml’.
Namespace_Modulename.xml
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0"?> <config> <modules> <Namespace_Modulename> <active>true</active> <codePool>local</codePool> </Namespace_Modulename> </modules> </config> |
Step 2.
Module configuration file is located at ‘app/code/<code_pool>/<name_space>/<module_name>/etc’ and its name is config.xml – so this path looks like ‘app/code/local/Namespace/Modulename/etc/config.xml’.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?xml version="1.0"?> <config> <modules> <Namespace_Modulename> <version>1.0.0</version> </Namespace_Modulename> </modules> <global> <resources> <add_category_attribute> <setup> <module>Namespace_Modulename</module> <class>Mage_Catalog_Model_Resource_Setup</class> </setup> <connection> <use>core_setup</use> </connection> </add_category_attribute> <add_category_attribute_write> <connection> <use>core_write</use> </connection> </add_category_attribute_write> <add_category_attribute_read> <connection> <use>core_read</use> </connection> </add_category_attribute_read> </resources> </global> </config> |
<add_category_attribute> presence that script must be located in the folder with the same name. ‘app/code/local/Namespace/Modulename/sql/add_category_attribute’
Step 3.
Create and install a script file in the folder ‘add_category_attribute’, and the file name depends on the module version.
mysql4-install-1.0.0.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php $this->startSetup(); $this->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'attribute_custom', array( 'group' => 'General Information', 'input' => 'textarea', 'type' => 'text', 'label' => 'Custom attribute', 'backend' => '', 'visible' => true, 'required' => false, 'visible_on_front' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, )); $this->endSetup(); ?> |
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-6286525a464b8482783360/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...