Je viens de suivre les instructions de ce lien , afin d'ajouter un nouvel attribut de produit. Après cela, la plupart de mes onglets de produits ont disparu.
Voici mes codes finaux:
/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>
Par exemple, la ligne d'attribut Name dans la table eav_attribute:
# 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
Table 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'
Maintenant, le problème est, même si je désactive ce module (et réindexation, déconnexion, connexion, recache), les onglets de la page produit ne s'affichent toujours pas et aucun attribut n'est ajouté. Comment puis-je résoudre ce problème ?