【问题标题】:Magento Doesn't Run Sql Setup ScriptMagento 不运行 Sql 设置脚本
【发布时间】:2012-07-04 09:59:18
【问题描述】:

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>

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
{

}

【问题讨论】:

  • 你是否开启了开发者模式?您是否收到任何其他错误?
  • stackoverflow.com/questions/4717535/… 和许多其他的可能重复
  • 为什么需要空白设置模型?
  • @Tim 他没有。如果不更改设置模型,可以直接使用Mage_Eav_Model_Entity_Setup
  • @blakcaps 你的 setup.php 文件代码是什么? lz你能告诉我吗?

标签: php magento


【解决方案1】:

感谢大家的建议。

,'select' 之后丢失

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

应该是

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    相关资源
    最近更新 更多