Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokanfar/d43374bd7891c341f9f9cad61d6973e6 to your computer and use it in GitHub Desktop.
Save mokanfar/d43374bd7891c341f9f9cad61d6973e6 to your computer and use it in GitHub Desktop.
Magento update from list of skus an attribute programatically
<?php
require_once 'app/Mage.php';
Mage::app();
$skus = array("ARRAY OF SKUS HERE");
$n=array();
foreach ($skus as $item) {
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item)->getId();
array_push($n, $product);
}
Mage::getSingleton('catalog/product_action')->updateAttributes($n, array('notes' => 'foo'), Mage_Core_Model_App::ADMIN_STORE_ID);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment