Step 1 :
Write below code in head.phtml after run one time remove the code.
$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('catalog_category', 'your_image', array( 'group' => 'General Information', 'input' => 'image', 'type' => 'varchar', 'label' => 'Your Image', 'backend' => 'catalog/category_attribute_backend_image', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, ));
Step 2 :
Override the Category model, copy Category.php file from app/code/core/Mage/Catalog/Model/Category.php to app/code/local/Mage/Catalog/Model/Category.php
Step 3 :
Add the following function in Category Model file
/* Return category image url * @return string * @author Sushant Vishwas */ public function getYourImageUrl() { $url = false; if ($image = $this->getYourImage()) { $url = Mage::getBaseUrl('media').'catalog/category/'.$image; } return $url; }
0 Comments