[ create a new paste ] login | about

Link: http://codepad.org/G6RhNXbJ    [ raw code | output | fork ]

PHP, pasted on Mar 31:
1
2
3
4
5
6
7
8
     $collection = Mage::getModel('catalog/product')->getCollection();
     $labor = 2;
     $currentSilverPrice = getPriceFromMetalsApiFunction('silver');    

     foreach ($collection as $product) {
         $newPrice = ($product->getWeight() * $currentSilverPrice) + ($product->getWeight() * $labor);
         $product->setPrice($newPrice)->save(); 
     }


Output:
1
2
3
4
5
6
7
8
     $collection = Mage::getModel('catalog/product')->getCollection();
     $labor = 2;
     $currentSilverPrice = getPriceFromMetalsApiFunction('silver');    

     foreach ($collection as $product) {
         $newPrice = ($product->getWeight() * $currentSilverPrice) + ($product->getWeight() * $labor);
         $product->setPrice($newPrice)->save(); 
     }


Create a new paste based on this one


Comments: