Skip to main content

Posts

Showing posts from August, 2013

Magento :: How to update products' attributes correctly without affecting tier prices

I use following code to update magento products without effecting tier prices. Because my earlier code cleared all tier prices after run code. Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);     $id = Mage::getModel('catalog/product')->getIdBySku($prod_sku);     $product = Mage::getModel('catalog/product')->load($id);     if ($product) {       $product->setBarcode($bar_code);       if(! $product->save()){                 $productId = $product->getId();                 echo "product_Id :: ".$productId." - Product sku :: ".$product->getSku()."<br />";             }else{                 echo "not saved";             }      }