Step:1. At first run this code
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Banner Image',
'input' => 'image',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'backend' => 'catalog/category_attribute_backend_image',
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'banner_image', $attribute);
$installer->endSetup();
Step 2:
Copy Category.php file from app/code/core/Mage/Catalog/Model/Category.php
to
app/code/local/Mage/Catalog/Model/Category.php
Add this code line 480
public function getBannerImageUrl()
{
$url = false;
if ($image = $this->getBannerImage()) {
$url = Mage::getBaseUrl('media').'catalog/category/'.$image;
}
return $url;
}
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Banner Image',
'input' => 'image',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'backend' => 'catalog/category_attribute_backend_image',
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'banner_image', $attribute);
$installer->endSetup();
Step 2:
Copy Category.php file from app/code/core/Mage/Catalog/Model/Category.php
to
app/code/local/Mage/Catalog/Model/Category.php
Add this code line 480
public function getBannerImageUrl()
{
$url = false;
if ($image = $this->getBannerImage()) {
$url = Mage::getBaseUrl('media').'catalog/category/'.$image;
}
return $url;
}
No comments:
Post a Comment