我只是按照此链接中的说明进行操作,以便添加新的产品属性。之后,我的大多数产品标签都消失了。
这是我的最终代码:
/app/code/local/MyCompany/MultiSlider/Model/Resource/Eav/Mysql4/Setup.php
<?php
class MyCompany_MultiSlider_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{
public function getDefaultEntities()
{
return array(
'catalog_product' => array(
'entity_model' => 'catalog/product',
'attribute_model' => 'catalog/resource_eav_attribute',
'table' => 'catalog/product',
'attributes' => array(
'myattribcode' => array(
'group' => 'Group/Tab',
'label' => 'My Attrib Label',
'type' => 'int',
'input' => 'boolean',
'default' => '0',
'class' => '',
'backend' => '',
'frontend' => '',
'source' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'visible_in_advanced_search' => false,
'unique' => false
),
)
),
// define attributes for other model entities here
);
}
}
/app/code/local/MyCompany/MultiSlider/sql/multislider_setup/mysql4-install-1.2.3.php
<?php
$installer = $this;
$installer->installEntities();
/app/code/local/MyCompany/MultiSlider/Helper/Data.php
<?php
class MyCompany_MultiSlider_Helper_Data extends Mage_Core_Helper_Abstract
{
}
/app/code/local/MyCompany/MultiSlider/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_MultiSlider>
<version>1.2.3</version>
</MyCompany_MultiSlider>
</modules>
<global>
<helpers>
<multislider>
<class>MyCompany_MultiSlider_Helper</class>
</multislider>
</helpers>
<models>
<multislider>
<class>MyCompany_MultiSlider_Model</class>
</multislider>
</models>
<resources>
<multislider_setup>
<setup>
<module>MyCompany_MultiSlider</module>
<class>MyCompany_MultiSlider_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</multislider_setup>
<multislider_write>
<connection>
<use>core_write</use>
</connection>
</multislider_write>
<multislider_read>
<connection>
<use>core_read</use>
</connection>
</multislider_read>
</resources>
</global>
</config>
例如,eav_attribute表中的Name属性行:
# attribute_id, entity_type_id, attribute_code, attribute_model, backend_model, backend_type, backend_table, frontend_model, frontend_input, frontend_label, frontend_class, source_model, is_required, is_user_defined, default_value, is_unique, note
'71', '4', 'name', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Name', NULL, NULL, '1', '0', NULL, '0', NULL
eav_attribute表
# attribute_group_id, attribute_set_id, attribute_group_name, sort_order, default_id
'1', '1', 'General', '1', '1'
'2', '2', 'General', '1', '1'
'3', '3', 'General', '10', '1'
'4', '3', 'General Information', '2', '0'
'5', '3', 'Display Settings', '20', '0'
'6', '3', 'Custom Design', '30', '0'
'7', '4', 'General', '1', '1'
'8', '4', 'Prices', '2', '0'
'9', '4', 'Meta Information', '3', '0'
'10', '4', 'Images', '4', '0'
'11', '4', 'Recurring Profile', '5', '0'
'12', '4', 'Design', '6', '0'
'13', '5', 'General', '1', '1'
'14', '6', 'General', '1', '1'
'15', '7', 'General', '1', '1'
'16', '8', 'General', '1', '1'
'17', '4', 'Gift Options', '7', '0'
'18', '4', 'Group/Tab', '8', '0'
现在的问题是,即使我禁用了此模块(以及重新索引,注销,登录,重新缓存),产品页面选项卡仍然没有显示,也没有添加任何属性。我怎么解决这个问题 ?
恢复备份
—
并重
@Jeroen那不是解决方案
—
chamich
@Jeroen是的,设置已经完成。这里有所有产品属性,例如,这里是产品名称属性:#attribute_id,entity_type_id,attribute_code,attribute_model,backend_model,backend_type,backend_table,frontend_model,frontend_input,frontend_label,frontend_class,source_model,is_required,is_user_defined,default_value,is_unique,note '71','4','名称',NULL,NULL,'varchar',NULL,NULL,'文本','名称',NULL,NULL,'1','0',NULL,'0', NULL ...请参阅更新的问题
—
chamich
因此,我有一个周末要思考,属性集组如何?eav_attribute_groups,都完整完整吗?或通过目录/属性/管理属性集
—
Jeroen
@Jeroen所以我有一个周末来恢复新的Magento备份:D。无论如何,让我们解决这个问题。我刚刚更新了问题bt,添加了eav_attribute_groups表内容。
—
chamich 2015年