我需要一點幫助在這裏 - 下來是Magento價格更新示例og php代碼,有人請給我一個提示如何把關係在這段代碼。Magento層價格批量變化
例如,我需要這個:如果價格> = 500,然後tier = 1.8 以下代碼增加所有價格,但我只需要提高價格等於或高於500美元的產品。
<?php
$server = "localhost";
$database = "";
$user = "";
$password = "";
$myConn = mysql_connect($server, $user, $password);
$select = mysql_select_db($database, $myConn);
$query = "SELECT
value_id, value
FROM
catalog_product_entity_decimal
ORDER BY
value_id
ASC";
$result = mysql_query($query) or die(mysql_error());
// 1.04 = 4% (duh) ovdje idu postavke marze
$tier = 1.04;
$i = 0;
while($row = mysql_fetch_array($result))
{
if($row["value"] != NULL)
{
$value = 0;
$value = $row["value"];
$value = round($value * $tier);
$updQuery = "UPDATE
catalog_product_entity_decimal
SET
value = ".$value."
WHERE
value_id = ".$row["value_id"];
$updResult = mysql_query($updQuery) or die(mysql_error());
$i++;
print "value_id: ".$row["value_id"]." | ";
print "old price: ".$row["value"]." -> ";
print "new price: ".$value."<br/>";
}
}
print "<br/><br/><hr><br/><b>".$i."</b> records updated.<br/><br/>Now go to system -> index management -> and reindex everything";
?>
任何人有一些意見? – Eager2Learn