0

I am creating a small magento extension to add a link to category banner image

I have this code to create an attribute but seems not to be working

app/code/community/Klevis/CategoryBannerLink/sql/Klevis_CategoryBannerLink_setup/install-0.0.1.php

 <?php 
$this->startSetup();
$this->addAttribute('catalog_category', 'category_banner_link', array(
'group'             => 'General',
'type'              => 'varchar',
'backend'           => '', 
'frontend_input'    => '',
'frontend'          => '',
'label'             => 'Banner Link',
'input'             => 'text',
'class'             => '',
'source'            => '', 
'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 
'visible'           => true, 
'frontend_class'    => '',
'required'          => false,
'user_defined'      => true,
'default'           => '',
'unique'            => false,
'note'              => ''
));
$this->endSetup();
Config file

app/code/community/Klevis/CategoryBannerLink/etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Klevis_CategoryBannerLink>
        <version>0.0.1</version>
    </Klevis_CategoryBannerLink>
</modules>
<global>
    <resources>
        <Klevis_CategoryBannerLink_setup>
            <setup>
                <module>Klevis_CategoryBannerLink</module>
                <class>Mage_Catalog_Model_Resource_Setup</class>
            </setup>
        </Klevis_CategoryBannerLink_setup>
    </resources>
</global>
</config>

Modules Xml file app/etc/modules/Klevis_CategoryBannerLink.xml

<?xml version="1.0"?>
<config>
<modules>
    <Klevis_CategoryBannerLink>
        <active>true</active>
        <codePool>local</codePool>
        <version>0.0.1</version>
    </Klevis_CategoryBannerLink>
</modules>
</config>

I don't see why this it not working. Thanks in advance for your help.

1
  • Please verify if any answer among these matches your requirements, or else share what else is needed. It helps others having same issues to navigate easily to the answer that worked. – TBI Infotech Jun 12 '14 at 5:07
3

Please go through these link I hope you find a good solution:

http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/programmatically_adding_attributes_and_attribute_sets

http://www.pixlpitch.com/programmatically-add-attribute-to-an-attribute-set-in-magento/

1

It appears from your code examples that you have set-up your code pool via the file app/etc/modules/Klevis_CategoryBannerLink.xml as local:

<codePool>local</codePool>

But your code is actually in the community pool by looking at your file names.

app/code/community/Klevis/CategoryBannerLink/etc/config.xml

With this in mind either move the files to the local pool or simply update the codePool to community.

0

Check the core_resource table to See if the Version number of your Extension is listed. In order to Run your installer script is has to be lower then in the module xml file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.