In Magento How to change the SKU for a Bulk amount of product?
If you want to change the SKU of large number of products with new one, you can do it by Magento Dataflow product import. Add a column named ‘your-new-sku’ and fill the values with that column in your product import CSV in addition to ”your-old-sku” and other required columns for data import. Add the following code in proper place (saveRow() function) in your corresponding Model Class file (app\code\core\Mage\Catalog\Model\Convert\Adapter\Product.php).
If ($importData[''your-new-sku'])
Mage::getModel('catalog/product')->loadBySku($importData[''your-old-sku'])->setSku($importData[''your-new-sku'])->save();






Dave
November 19th, 2010 at 6:28 am
Hello,
Thanks for this great submit, i am searching for days now how to do this and not get messy in php/msql…
Got one major question, i got the php file, but really do not know where to put your code excactly???
Could you help me out, how it should look like, as i cannor find
saveRow() function)
Big thx in advance… !!!
admin
November 19th, 2010 at 11:12 pm
Please note that you can find the saveRaw function at line number 510 aproximatly in the file app\code\core\Mage\Catalog\Model\Convert\Adapter\Product.php
Binu Sankaran
Ecsso Team member
Tom
July 28th, 2011 at 8:30 pm
I have tried several way on adding this little line of code, and get no results. I have added it right after the “public function saveRow(array $importData)” which is on line 527 in my installation. Then in my export csv file I added a column “new_sku”.
#1 First Try
If ($importData[''new_sku'])
Mage::getModel(‘catalog/product’)->loadBySku($importData[''sku'])->setSku($importData[''new_sku'])->save();
#2 Second Try
If ($importData['new_sku'])
Mage::getModel(‘catalog/product’)->loadBySku($importData['sku'])->setSku($importData['new_sku'])->save();
If there is anyone that could tell me what I am doing wrong please help me. The version is 1.5.1