Magento – Product page tabs disappeared in admin after trying to add a new product attribute

admincatalogmagento-1.9productproduct-attribute

I just followed instructions in this link, in order to add a new product attribute. After that most of my product tabs disappeared.

enter image description here

Here are my final codes:

/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>

As an example, Name attribute row in eav_attribute table:

# 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 table

# 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'

Now the problem is, even if I disable this module (and reindex, logout, login, recache), the product page tabs still not showing and no attributes added. How can I solve this problem ?

Best Answer

On that page you can see a section that says (in Step 4: Define your entities):

"From Magento 1.4, don’t forget to add these following lines. Between ‘table’ and ‘attributes’ elements. ;)

'additional_attribute_table' => 'catalog/eav_attribute',
'entity_attribute_collection' => 'catalog/product_attribute_collection',

Without that, the General, Meta, Images, ... Tabs will not showing up in the product edit page. "

If you hadn't allready fixed it via a backup you could have added those two lines below

'table' => 'catalog/product',

And re-ran the script by updating the core_resourses table to the required version to make the script run again.

Related Topic