- $collection = Mage::getResourceModel(’catalog/product_collection’)->load();
- foreach($collection as $items){
- $product = Mage::getModel(’catalog/product’)->load($items->getId());
- $product->setPrice(round($product->getPrice()*1.2));
- if($product->getSpecialPrice()){
- $product->setSpecialPrice(round($product->getSpecialPrice()*1.2));
- }
- $product->save();
- } 换成
- $collection = Mage::getResourceModel(’catalog/product_collection’)->load();
- foreach($collection as $items){
- $product = Mage::getModel(’catalog/product’)->load($items->getId());
- $product->setPrice(round($product->getPrice()*1.2));
- if($product->getSpecialPrice()){
- $product->setSpecialPrice(round($product->getSpecialPrice()*1.2));
- }
- $product->save();
- }
|