Magento在组顶部添加属性

时间:2015-01-27 14:53:01

标签: magento

我有magento 1.8。我想在产品中添加产品属性。我可以做所有这些但是当我想在组中添加特定属性位于其他人(在后台的排序顺序)之上时。我怎么能这样做?

$this->addAttribute('catalog_product', 'my_subtitle', array(
'attribute_model'                 => NULL,
'backend'                         => NULL,
'type'                            => 'text',
'table'                           => NULL,
'frontend'                        => NULL,
'input'                           => 'text',
'label'                           => 'Subtitle',
'frontend_class'                  => NULL,
'source'                          => NULL,
'required'                        => '0',
'user_defined'                    => true,
'default'                         => NULL,
'unique'                          => '0',
'note'                            => NULL,
'input_renderer'                  => NULL,
'visible'                         => '1',
'searchable'                      => '1',
'filterable'                      => '1',
'comparable'                      => '1',
'visible_on_front'                => '1',
'is_html_allowed_on_front'        => '1',
'is_used_for_price_rules'         => '0',
'filterable_in_search'            => '0',
'used_in_product_listing'         => '1',
'used_for_sort_by'                => '0',
'is_configurable'                 => '0',
'visible_in_advanced_search'      => '0',
'position'                        => '0',
'wysiwyg_enabled'                 => '0',
'used_for_promo_rules'            => '0',
'apply_to'                        => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
'global'                          => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,));

1 个答案:

答案 0 :(得分:1)

尝试添加:

'sort_order'                 => -1,  // Or 0

$this->addAttribute('catalog_product', 'my_subtitle', array(
    'sort_order'                 => -1,  // Or 0
    ...
    )
);

这样,根据sort_order

,您的新属性应显示在其余属性之前