Question

I have magento 1.6.2 and want to try to install a extension.

But i get an error.

I know it wants to add some extra attributes to my database. Because it says Wrong attribute set ID but i don't see any id's in the mysql4-install-0.1.0.php file. Am i missing somthing?

This is the error on the page:

    Mage_Eav_Exception Object
(
    [_messages:protected] => Array
        (
        )

    [message:protected] => Wrong attribute set ID
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /path to magento/app/Mage.php
    [line:protected] => 549
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Eav/Model/Entity/Setup.php
                    [line] => 318
                    [function] => exception
                    [class] => Mage
                    [type] => ::
                    [args] => Array
                        (
                            [0] => Mage_Eav
                            [1] => Wrong attribute set ID
                        )

                )

            [1] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Eav/Model/Entity/Setup.php
                    [line] => 426
                    [function] => getAttributeSetId
                    [class] => Mage_Eav_Model_Entity_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => catalog_product
                            [1] => Default
                        )

                )

            [2] => Array
                (
                    [file] => /path to magento/path to mysql file/mysql4-install-0.1.0.php
                    [line] => 19
                    [function] => addAttributeGroup
                    [class] => Mage_Eav_Model_Entity_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => catalog_product
                            [1] => Default
                            [2] => Video
                            [3] => 1000
                        )

                )

            [3] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 624
                    [args] => Array
                        (
                            [0] => /path to magento/path to mysql file/mysql4-install-0.1.0.php
                        )

                    [function] => include
                )

            [4] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 421
                    [function] => _modifyResourceDb
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => install
                            [1] => 
                            [2] => 0.1.3
                        )

                )

            [5] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 327
                    [function] => _installResourceDb
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 0.1.3
                        )

                )

            [6] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php
                    [line] => 235
                    [function] => applyUpdates
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [7] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/App.php
                    [line] => 412
                    [function] => applyAllUpdates
                    [class] => Mage_Core_Model_Resource_Setup
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [8] => Array
                (
                    [file] => /path to magento/app/code/core/Mage/Core/Model/App.php
                    [line] => 338
                    [function] => _initModules
                    [class] => Mage_Core_Model_App
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [9] => Array
                (
                    [file] => /path to magento/app/Mage.php
                    [line] => 640
                    [function] => run
                    [class] => Mage_Core_Model_App
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [scope_code] => 
                                    [scope_type] => store
                                    [options] => Array
                                        (
                                        )

                                )

                        )

                )

            [10] => Array
                (
                    [file] => /path to magento/index.php
                    [line] => 80
                    [function] => run
                    [class] => Mage
                    [type] => ::
                    [args] => Array
                        (
                            [0] => 
                            [1] => store
                        )

                )

        )

    [previous:Exception:private] => 
)

And i also get a error repoort. This is the content of it:

a:5:{i:0;s:178:"Error in file: "/path to magento/path to mysql file/mysql4-install-0.1.0.php" - Wrong attribute set ID";i:1;s:1164:"#0 /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '0.1.3')
#2 /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb('0.1.3')
#3 /path to magento/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /path to magento/app/code/core/Mage/Core/Model/App.php(412): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /path to magento/app/code/core/Mage/Core/Model/App.php(338): Mage_Core_Model_App->_initModules()
#6 /path to magento/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#7 /path to magento/index.php(80): Mage::run('', 'store')
#8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

The problem file is mysql4-install-0.1.0.php Here is file:

<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Alesioo
 * Date: 12.12.12
 * Time: 16:24
 * To change this template use File | Settings | File Templates.
 */ 
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();

/**
 * Adding Different Attributes
 */

// adding attribute group
$setup->addAttributeGroup('catalog_product', 'Default', 'Video', 1000);

$setup->addAttribute('catalog_product', 'videobox', array(
    'group'         => 'Video',
    'input'         => 'textarea',
    'type'          => 'text',
    'label'         => 'Youtube video url',
    'backend'       => '',
    'visible'       => 1,
    'required'      => 0,
    'user_defined' => 1,
    'searchable' => 0,
    'filterable' => 0,
    'comparable'    => 0,
    'visible_on_front' => 1,
    'visible_in_advanced_search'  => 0,
    'is_html_allowed_on_front' => 0,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));


$setup->addAttribute('catalog_product', 'customtab', array(
    'group'         => 'Custom Tab',
    'input'         => 'textarea',
    'type'          => 'text',
    'label'         => 'Custom Tab',
    'backend'       => '',
    'visible'       => 1,
    'required'      => 0,
    'user_defined' => 1,
    'searchable' => 0,
    'filterable' => 0,
    'comparable'    => 0,
    'visible_on_front' => 1,
    'visible_in_advanced_search'  => 0,
    'is_html_allowed_on_front' => 0,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

$setup->addAttribute('catalog_category', 'menutopdescription1', array(
    'group'         => 'General',
    'input'         => 'textarea',
    'type'          => 'text',
    'label'         => 'Topmenu description',
    'backend'       => '',
    'visible'       => 1,
    'required'      => 0,
    'is_wysiwyg_enabled' => 1,
    'visible_on_front' => 1,
    'note'=>'Category description for top menu dropdown',
    'is_html_allowed_on_front' => 1,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

$setup->addAttribute('customer', 'twitterid', array(
    'label'     => 'TwitterID',
    'type'      => 'varchar',
    'input'     => 'text',
    'visible'   => true,
    'required'  => 0,
    'position'  => 1,
));

$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute('customer', 'twitterid');
$attribute->save();

$attribute_1 = $eavConfig->getAttribute('catalog_category', 'menutopdescription1');
$attribute_1->setData('is_wysiwyg_enabled', 1);
$attribute_1->save();

$installer->endSetup();
Was it helpful?

Solution

The error comes from the line:

$setup->addAttributeGroup('catalog_product', 'Default', 'Video', 1000);

It can't find an attribute set named 'Default' for the entity type 'catalog_product'.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top