Magento - 添加全局产品属性

时间:2012-03-23 12:42:54

标签: magento magento-1.4

我无法真正找到满意的答案:

模块将新产品属性添加到所有属性集(以及可能位于特定位置)的最佳做法是什么。

我能找到的所有方法似乎都指的是只为一个属性集添加一个新属性。

2 个答案:

答案 0 :(得分:4)

有一种红色的方式 例如:

$installer->addAttribute('catalog_product', 'test_me', array(
'label'         => 'test Me',
'input'         => 'textarea',
'type'          => 'text',
'class'         => '',
'global'        => true,
'visible'       => true,
'required'      => false,
'user_defined'  => true,
'default'       => '',
'apply_to'      => 'simple,configurable',
'visible_on_front' => true,
'is_configurable' => false,
'wysiwyg_enabled' => true,
'used_in_product_listing' => true,
'is_html_allowed_on_front' => true,
'group'         => 'Config',
'sort_order'    => 25

));

要为每个attribute_set添加属性,您需要设置'user_defined' = true并设置'group' = 'your_group_name'。如果需要,magento会将您的组添加到每个属性集,并将属性附加到其中。

答案 1 :(得分:0)

添加属性后,您可以将其分配给一个或所有属性集,它不是您为其分配的第一个集所独有的。这是否回答了你的问题?

相关问题