Need help buying now? +48-22-219-5163 +1-917-720-3250
My Cart

Your Cart is Empty

Need help buying now?
+48-22-219-5163 +1-917-720-3250

How to change a set of attributes for a product

How to change a set of attributes for a product

Sometimes different product groups or categories require individual set of attributes. In this article we will review how to change a set of attributes for existing products without additional Magento extensions.

First, you need to open the file app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php.

Then, locate the line $this->getMassactionBlock()->addItem('attributes', array(.

You need to paste the following code above that line:

$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
  array_unshift($statuses, array('label'=>'', 'value'=>''));
  $this->getMassactionBlock()->addItem('attribute_set', array(
       'label'=> Mage::helper('catalog')->__('Change attribute set'),
       'url'  => $this->getUrl('*/*/massAttributeSet', array('_current'=>true)),
       'additional' => array(
              'visibility' => array(
                   'name' => 'attribute_set',
                   'type' => 'select',
                   'class' => 'required-entry',
                   'label' => Mage::helper('catalog')->__('Change attribute set),
                   'values' => $sets

In order to continue modification - open the file app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php.

Locate the line ‘protected function _isAllowed()’ and paste the following code above that line:

public function massAttributeSetAction()
    $productIds = $this->getRequest()->getParam('product');
    $storeId = (int)$this->getRequest()->getParam('store', 0);
    if(!is_array($productIds)) {
        $this->_getSession()->addError($this->__('Please select product(s)'));
    } else {
        try {
            foreach ($productIds as $productId) {
                $product = Mage::getSingleton('catalog/product')
            Mage::dispatchEvent('catalog_product_massupdate_after', array('products'=>
                $this->__('Total of %d record(s) were successfully updated', 
        } catch (Exception $e) {
    $this->_redirect('*/*/', array('store'=>(int)$this->getRequest()->
    getParam('store', 0)));

After the changes in those files are saved the option ‘Change attribute set’ will appear in Catalog -> Manage products -> Actions menu and you can use it further to make the necessary changes.

If you have any problems or additional questions please feel free to consult with our Magento experts. Please share the most interesting articles with your friends and leave your comments, we highly appreciate your opinion.