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(); ?> |
[crayon-63d3d58405573597914807/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.