1

Can anyone tell me how to sort the order of attribute sets when creating new products in Magento.

From question: How to sort the Attribute Set list on the Manage Products Grid dropdown menu? I can see how it is done for the manage product grid. But it is even more needed when creating new products

1 Answer 1

1

Ok, so once you've created the module described in the answer you posted you need to add the following:

Change the config.xml to the following:

<?xml version="1.0"?>
<config>
    <modules>
        <MyProject_Catalog>
            <version>1.0.0</version>
        </MyProject_Catalog>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <catalog_product_grid>MyProject_Catalog_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
                    <catalog_product_edit_tab_settings>MyProject_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Settings</catalog_product_edit_tab_settings>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>
</config>

Then create the following file app/code/local/MyProject/Catalog/Block/Adminhtml/Catalog/Product/Edit/Tab/Settings.php

<?php
class MyProject_Catalog_Block_Adminhtml_Catalog_Product_Edit_Tab_Settings 
    extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Settings
{
    public function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $fieldset = $form->addFieldset('settings', array('legend'=>Mage::helper('catalog')->__('Create Product Settings')));

        $entityType = Mage::registry('product')->getResource()->getEntityType();

        $fieldset->addField('attribute_set_id', 'select', array(
            'label' => Mage::helper('catalog')->__('Attribute Set'),
            'title' => Mage::helper('catalog')->__('Attribute Set'),
            'name'  => 'set',
            'value' => $entityType->getDefaultAttributeSetId(),
            'values'=> Mage::getResourceModel('eav/entity_attribute_set_collection')
                ->setEntityTypeFilter($entityType->getId())
                ->setOrder('attribute_set_name', 'asc')
                ->load()
                ->toOptionArray()
        ));

        $fieldset->addField('product_type', 'select', array(
            'label' => Mage::helper('catalog')->__('Product Type'),
            'title' => Mage::helper('catalog')->__('Product Type'),
            'name'  => 'type',
            'value' => '',
            'values'=> Mage::getModel('catalog/product_type')->getOptionArray()
        ));

        $fieldset->addField('continue_button', 'note', array(
            'text' => $this->getChildHtml('continue_button'),
        ));

        $this->setForm($form);
    }
}
1
  • actually I did not manage to make it work my creating a module as suggested in the linked thread. I can only make it work by changing the file app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php as descibed. Using magento 1.9.2.3
    – lalord
    Commented May 14, 2016 at 8:50

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.