0
votes

Magento doesn't run installer script of my module.But setup script version is getting added in core_resource table.Here are my files

Part of config.xml

    <config>
        <modules>
            <Company_Brands>
                <version>1.0.0</version>
            </Company_Brands>
        </modules>
        <global>
            <models>
                <brands>
                    <class>Company_Brands_Model</class>
                    <resourceModel>brands_mysql4</resourceModel>
                </brands>
                <brands_mysql4>
                    <class>Company_Brands_Model_Mysql4</class>              
                </brands_mysql4>
            </models>

        <resources>
            <brands_setup>
                <setup>
                    <module>Company_Brands</module>
                    <class>Company_Brands_Model_Mysql4_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </brands_setup>
            <brands_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </brands_read>
            <brands_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </brands_write>
        </resources>
</global>
</config>

app/code/local/Company/Brands/sql/brands_setup/mysql4-install-1.0.0.php

$installer = $this;
$installer->startSetup();

$data = array(
    'label' => 'Brands',
    'type' => 'select'
    'input' => 'text',
    'global'=> Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'required'=>false,
    'is_configurable'=>true,
    'compareble'=>true,
    'filterable' =>true,
    'searchable'=>true
);

$installer->addAttribute('catalog_product','some_brands',$data);

$installer->endSetup();

app/code/local/Company/Brands/Model/Mysql4/Setup.php

class Company_Brands_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{

}
1
Do you have developer mode turned on? Are you receiving any other errors?Sturm
Possible duplicate of stackoverflow.com/questions/4717535/… and many othersuser487772
Why do you need blank Setup model?user487772
@Tim He didn't. If you don't make changes to the setup model, one can use the Mage_Eav_Model_Entity_Setup directly.feeela
@blakcaps what is your code for setup.php file ? plz can you tell me?MageDev

1 Answers

0
votes

Thanks for everyone's suggestions.

, was missing after 'select'

$data = array(
    'label' => 'Brands',
    'type' => 'select'
    'input' => 'text',

It should be

$data = array(
        'label' => 'Brands',
        'type' => 'select',
        'input' => 'text',