我試圖通過使用此代碼編程方式更新產品的價格產品的價格。如何Magento更新程序
$id = 1;
$product = Mage::getModel('catalog/product')->load($id);
$product->setPrice($price);
$product->setUrlKey(false);
$product->save();
但在產品列表頁面上它顯示的像這樣就像我有一些特殊的價格。
當我使用var_dump()
它顯示我改價格price
但min,max,final
還是以前的價格不被改變的一個。
["price"]=>string(7) "18.0000"
["final_price"]=>string(7) "16.0000"
["minimal_price"]=>string(7) "16.0000"
["min_price"]=>string(7) "16.0000"
["max_price"]=>string(7) "16.0000"
我也試過這個代碼
$product = Mage::getModel('catalog/product')->load($id);
$product->setPrice($price);
$product->setFinalPrice($price);
$product->setMinimalPrice($price);
$product->setMinPrice($price);
$product->setMaxPrice($price);
$product->setUrlKey(false);
$product->save();
,但仍表現出我同樣的結果在final,min,max
您是否從管理區重新編制catalog_product_price的索引? –
不可以從前端執行 – OBAID
您可以從管理員區域或SSH命令執行此操作。 –