以编程方式创建的属性出现在数据库中,但不出现在Magento后端中

时间:2014-05-07 09:35:54

标签: php magento attributes

在新的Magento扩展程序中,我创建了一些自定义产品属性 但是,当我测试扩展时,属性不会出现在后端。 当我查看数据库时,我看到属性已创建...

我是否有可能忘记Setup.php中的某些内容?

那是我的代码: /Model/Resource/Eav/Setup.php

/**
 * @return array
 * An array with product entities: medipim_version
 */
public function getDefaultEntities()
{

    /*$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
    $setup->removeAttribute('catalog_product','medipim_version');*/
    //
    return array(
        'catalog_product' => array(
            'entity_model'                  =>  'catalog/product',
            'attribute_model'               =>  'catalog/resource_eav_attribute',
            'table'                         =>  'catalog/product',
            'additional_attribute_tabel'    =>  'catalog/eav_attribute',
            'entity_attribute_collection'   =>  'catalog/product_attribute_collection',
            'attributes'    => array(
                'medipim_version' => array(
                    'group'                             =>  'Medipim data',
                    'label'                             =>  'Version',
                    'type'                              =>  'varchar',
                    'input'                             =>  'text',
                    'default'                           =>  '',
                    //'class'                             =>  '',
                    //'backend'                           =>  '',
                    //'frontend'                          =>  '',
                    //'source'                            =>  '',
                    'global'                            =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                    'visible'                           =>  1,
                    'required'                          =>  0,
                    'user_defined'                      =>  1,
                    //'searchable'                        =>  0,
                    //'filterable'                        =>  0,
                    //'comparable'                        =>  0,
                    'visible_on_front'                  =>  1,
                    'is_html_allowed_on_front'          =>  0,
                    'used_in_product_listing'           =>  1,
                    //'visible_in_advanced_search'        =>  0,
                    'unique'                            =>  0,
                ),
            ),
        ),
    );
}
 }

SQL / medipim_setup_product_entities / mysql4安装-0.1.0.php

<?php

$installer = $this;

$installer->installEntities();

等/ config.xml中

    <?xml version="1.0"?>
    <config>
        <modules>
            <Crmart_Medipim>
                <version>0.1.0</version>
            </Crmart_Medipim>
        </modules>
        <global>
            <helpers>
                <medipim>
                    <class>Crmart_Medipim_Helper</class>
                </medipim>
            </helpers>
            <models>
                <medipim>
                    <class>Crmart_Medipim_Model</class>
                </medipim>
            </models>
            <resources>
                <medipim_setup_product_entities>
                    <setup>
                        <module>Crmart_Medipim</module>
                        <class>Crmart_Medipim_Model_Resource_Eav_Setup</class>
                    </setup>
                </medipim_setup_product_entities>
                <medipim_write>
                    <connection>
                        <use>core_write</use>
                    </connection>
                </medipim_write>
                <medipim_read>
                    <connection>
                        <use>core_read</use>
                    </connection>
                </medipim_read>
            </resources>
        </global>
    </config>

在我的安装程序类中,我输入了&#39; additional_attribute_tabel&#39;而不是&#39; additional_attribute_table&#39;。

1 个答案:

答案 0 :(得分:2)

我解决了它。

在我的安装程序类中,我输入了&#39; additional_attribute_tabel&#39;而不是&#39; additional_attribute_table&#39;。