Parag Dave
Parag Dave

Reputation: 49

change position of category attribute in General information in magento

How to change attribute position in category up or down as per requirement? How to change attribute position in category up or down as per requirement?

Upvotes: 1

Views: 4308

Answers (4)

Mike Chikoi
Mike Chikoi

Reputation: 43

You can achieve this via an update script

$installer->run("
    update {$installer->getTable('eav_entity_attribute')} set `sort_order`=1 where `attribute_id`=(select `attribute_id` from {$installer->getTable('eav_attribute')} where `attribute_code`='short_description');
");

If the sort order is not correct, try setting the sort_order value to 0 or as a last resort, change the sort_order values of other attributes as well.

Upvotes: 1

Jelle Verzijden
Jelle Verzijden

Reputation: 3

Some things can be solved without going into the code :)

Just: 1. Go into your Catalog/attribute/manage attribute sets/ your attributeset. 2. Drag and drop the attribute where you want it 3. Save your attribute set

enter image description here

Upvotes: -4

Marius
Marius

Reputation: 15216

Here is an ugly way of doing it but I have nothing else.

The attribute position in the attribute groups is kept in the eav_entity_attribute table.
First you need to identify the id of your attribute short_description.

Here is the query for that.

SELECT 
    attribute_id, attribute_code
FROM 
    eav_attribute 
WHERE
    attribute_code = 'short_description' AND
    entity_type_id = (SELECT 
                          entity_type_id
                      FROM
                          eav_entity_type
                      WHERE 
                          entity_type_code = 'catalog_category'
                     ) 

Let's say the attribute id you get is 100.

Then you need to get the attributes id of the attribute that should be above your attribute and below it.

Use the same query above but change the attribute code from short_description to is_anchor and description.

Let's say you got the values 10 for is_anchor and 15 for description.

Then see their position in the attribute sets.

SELECT * FROM `eav_entity_attribute` where `attribute_id` in (10, 15, 100);

Look at the sort_order field.
Let's say you have something like this:

attribute_id|sort_order
10          | 40            //is_anchor attribute
15          | 50            //description attribute
100         | 120           //shot_description attribute

All you need now is to update the sort_order for the short_description attribute to be between the values for is_anchor and description.
In the example above you will need 45

UPDATE `eav_entity_attribute` set `sort_order` = 45 where `attribute_id` = 100

Upvotes: 4

Gerard de Visser
Gerard de Visser

Reputation: 8050

The backend category page is rendered from files in:

app/design/adminhtml/default/default/template/catalog/category    
app/code/core/Mage/Adminhtml/Block/Catalog/Category

But it's complex and there's also a lot of javascript in there.

Upvotes: 1

Related Questions