Change the product attribute of Magento.

I want to change the Magento attribute set. I looked through and everyone suggested deleting the product and re-importing it with a new set of attributes.

I did the same, but after importing the data, I could not see product reviews and related product blog posts.

Can someone tell me that you can get product reviews and related blog posts after re-importing a product with a new set of attributes.

+6
source share
6 answers

After installation, you cannot change the set of product attributes. But it’s possible to use this module, so you do not need to reimport your data https://marketplace.magento.com/flagbit-magento-changeattributeset.html

+12
source

It is also possible to change the attribute set directly in the database.

  • See the attribute set identifier in the eav_attribute_set table
  • Change the attribute set identifier in catalog_product_entity

Of course, be careful when changing data this way.

+5
source

This is inconvenient to do and a little dirty:

  • Make sure the new attribute set is set.
  • Export the products you want to change.
  • Remove the products that you are changing on the site.
  • Change the attribute set in the downloaded file
  • Import modified file again
  • Open each changed product, set its attribute values, save it

Or do what I do, install this large extension from Amasty http://amasty.com/mass-product-actions.html - it changes the wind and gives much more time to save and improve parameters.

+2
source

After uninstalling the product, you will not be able to get the old review.

You do not need to remove the product. You can change the attribute set by editing and using. other wise ones create a new set of attributes and create a new product.

+1
source

I use this extension to modify attribute sets.

I used to have the extension you recommended above, and that's cool. But the first has more features.

0
source

Yes. We can programmatically change the set of product attributes. I prefer to create massaction in the product grid of the catalog to multiselect the product, and then select massaction for the products.

Creating massaction in grid.php

 $sets = Mage::getResourceModel('eav/entity_attribute_set_collection') ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()) ->load() ->toOptionHash(); $this->getMassactionBlock()->addItem('changeattributeset', array( 'label'=> Mage::helper('catalog')->__('Change attribute set'), 'url' => $block->getUrl('*/*/changeattributeset', array('_current'=>true)), 'additional' => array( 'visibility' => array( 'name' => 'attribute_set', 'type' => 'select', 'class' => 'required-entry', 'label' => Mage::helper('catalog')->__('Attribute Set'), 'values' => $sets ) ) )); 

Create a controller action for change attribute sets for selected products.

 public function changeattributesetAction() { $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') ->unsetData() ->setStoreId($storeId) ->load($productId) ->setAttributeSetId($this->getRequest()->getParam('attribute_set')) ->setIsMassupdate(true) ->save(); } Mage::dispatchEvent('catalog_product_massupdate_after', array('products'=>$productIds)); $this->_getSession()->addSuccess( $this->__('Total of %d record(s) were successfully updated', count($productIds)) ); } catch (Exception $e) { $this->_getSession()->addException($e, $e->getMessage()); } } $this->_redirect('adminhtml/catalog_product/index/', array()); } 
0
source

Source: https://habr.com/ru/post/947208/


All Articles