Reputation: 677
I have magento 1.8. and i want to add product attribute in product. I can do all of that but when I want to add specific attribute to be located on top of others (sorting order in back office) in group. How can i do this?
$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,));
Upvotes: 1
Views: 126
Reputation: 2123
Try adding:
'sort_order' => -1, // Or 0
Ie.
$this->addAttribute('catalog_product', 'my_subtitle', array(
'sort_order' => -1, // Or 0
...
)
);
This way, your new attribute should be displayed before the rest, as per the sort_order
.
Upvotes: 1