【问题标题】:how to add attributes to a category in magento with sql?如何使用sql将属性添加到magento中的类别?
【发布时间】:2011-06-23 09:26:51
【问题描述】:

如何在 magento 中为类别添加属性?

我已经阅读了一些教程,他们说只需插入两条记录,但这不起作用 已经改变了很多并使用了这些值但仍然没有结果

每次更改后我都清除了缓存,所以这不是问题

我正在使用 magento 1.5 和平面表

插入下一个查询并使用值进行测试

INSERT INTO `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`
) 
VALUES
(
    158, 
    3, 
    'uitslag', 
    NULL, 
    '', 
    'varchar', 
    '', 
    '', 
    'text', 
    'Uitslag', 
    '', 
    '', 
    1, 
    0, 
    '', 
    0, 
    ''
);

INSERT INTO `eav_entity_attribute` 
(
    `entity_attribute_id`, 
    `entity_type_id`, 
    `attribute_set_id`, 
    `attribute_group_id`, 
    `attribute_id`, 
    `sort_order`
) 
VALUES
(
    158, 
    3, 
    3, 
    3, 
    158, 
    61
);

谁有想法?

提前致谢

【问题讨论】:

  • 嗯,catalog_category_entity* 表呢?

标签: php sql magento attributes categories


【解决方案1】:

试试这样的:

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('category', 'uitslag', array(
                     'label'     => 'Uitslag',
                     'type'  => 'varchar',
                     'input'     => 'text',
                     'visible'  => true,
                     'required' => false,
                     'position' => 1,
));

只需通过 Magento 管理员将值添加到类别,或直接添加到 catalog_category_entity_varchar 表中。

【讨论】:

    猜你喜欢
    • 2019-01-14
    • 2014-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多