3

I've added a custom attribute for all the categories. It's currently positioned as the first element in the list when you configure a category. How would I go about about changing it's position in the list? I've tried using the position key in the setup script, but alas no luck. It does get saved in the database, other than that it has no (visual) effect.

setup script:

<?php
/** @var Mage_Catalog_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();

$installer->addAttribute('catalog_category', 'custom_menu', array(
    'type'     => 'int',
    'input'    => 'select',
    'source'   => 'eav/entity_attribute_source_boolean',
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'required' => false,
    'label'    => 'Is Custom',
    'default'  => 0,
    'group' => 'Menu',
    'position' => 100
));

$installer->endSetup();

1 Answer 1

1

Please use sort_order instead of position.

Edit:

Tested on 1.9.3.1 and sort_order works ... please check the other attributes position and adjust (increase) sort_order value.

If you want do this from DB ...

UPDATE `eav_entity_attribute` set `sort_order` = XYZ where `attribute_id` = XYZ

Get current sort order via ...

SELECT eav.attribute_id, eav.attribute_code, att.sort_order
FROM eav_entity_attribute AS att
LEFT JOIN eav_attribute AS eav ON (eav.attribute_id = att.attribute_id)
LEFT JOIN eav_attribute_group AS grp ON (grp.attribute_group_id = att.attribute_group_id)
WHERE grp.attribute_group_name = 'Menu'
ORDER BY att.sort_order ASC
3
  • Alas, same result. It gets saved in the database. No changes on the adminhtml page. I've cleared the cashes with magerun and restarted varnish to be sure.
    – zazoe
    Commented Jun 12, 2017 at 17:52
  • Updated answer.
    – sv3n
    Commented Jun 12, 2017 at 21:57
  • Hero. That worked! sort_order wan't high enough.
    – zazoe
    Commented Jun 13, 2017 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.