Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Created January 7, 2015 18:23
Show Gist options
  • Select an option

  • Save ryaan-anthony/4e72918cb9be645ad267 to your computer and use it in GitHub Desktop.

Select an option

Save ryaan-anthony/4e72918cb9be645ad267 to your computer and use it in GitHub Desktop.
<?php
include 'app/Mage.php';
Mage::app();
$file = fopen("skus.csv", "r");
while ($data = fgetcsv($file, 1000, ",")) {
$old = $data[0];
$new = $data[1];
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $old);
if($product && $product->getId()){
$product->setSku($new);
$product->save();
}
}
fclose($file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment