1.新建一个page
2{{block type="catalog/product_list" name="fdfsfd" template="ter/ter.phtml"}}
3新建ter/ter.phtml文件
里面包含如下代码:
<?php $currentStore = $this->getStoreId();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
//
$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();
}
//
Mage::app()->setCurrentStore($currentStore);
?>
4执行这个page。