0

我有 magento 1.6.2 并想尝试安装扩展。

但我得到一个错误。

我知道它想为我的数据库添加一些额外的属性。因为它说Wrong attribute set ID但我在mysql4-install-0.1.0.php文件中看不到任何ID。我错过了什么吗?

这是页面上的错误:

    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] => 
)

我也收到错误报告。这是它的内容:

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";}

问题文件是mysql4-install-0.1.0.php 这里是文件:

<?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();
4

1 回答 1

3

错误来自以下行:

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

它找不到以'Default'实体类型命名的属性集'catalog_product'

于 2013-09-12T14:40:03.057 回答