Wednesday, March 13, 2013

Magento Addding the Image Attribute

Adding the Attribute for Product is quite easy but Adding an Attribute for Categroy  is not easy but also not hard ,Just need to follow the magento Structure instead of Running the Query from PHPmyadmin

We can added either text field or an another image Attribute just open header.phtml Or any of the Phtml File and just add the following code which will help to generate the attribute in admin for category and also add in the Database also



Add the Following code

<?php
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'sliderimage4', array(
    'group'         => 'General',
    'input'         => 'image',
    'type'          => 'varchar',
    'label'         => 'Slider Image4',
    'backend'       => 'catalog/category_attribute_backend_image',
    'visible'       => 1,
    'required'        => 0,
    'user_defined' => 1,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
?>

Here sliderimage4 is the Attribute ..in this way you can add as many attribute as you can

Note:Once you run the script remove the code from phtml file ...Hope this will help you

2 comments:

  1. Thanks for sharing this wonderful blog to us. My Scottsdale SEO team mates surely appreciates this. Have a nice day!

    ReplyDelete
  2. Hi Sandeep ,

    Nice blog ,Thanks for sharing this information ,i will try this one.






    Magento Developers

    ReplyDelete

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...