Magento不运行Sql安装脚本

时间:2012-07-04 09:59:19

标签: php magento

Magento没有运行我的模块的安装程序脚本。但是在core_resource表中添加了安装脚本版本。这是我的文件

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>

应用程序/代码/本地/公司/品牌/ SQL / brands_setup / mysql4安装-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();

应用程序/代码/本地/公司/品牌/型号/ Mysql4 / Setup.php

class Company_Brands_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{

}

1 个答案:

答案 0 :(得分:0)

感谢大家的建议。

,

之后

'select'丢失了

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

应该是

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