本文整理匯總了PHP中SpecificPrice::getIdsByProductId方法的典型用法代碼示例。如果您正苦於以下問題:PHP SpecificPrice::getIdsByProductId方法的具體用法?PHP SpecificPrice::getIdsByProductId怎麽用?PHP SpecificPrice::getIdsByProductId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SpecificPrice
的用法示例。
在下文中一共展示了SpecificPrice::getIdsByProductId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: duplicateSpecificPrices
public static function duplicateSpecificPrices($oldProductId, $productId)
{
foreach (SpecificPrice::getIdsByProductId((int) $oldProductId) as $data) {
$specificPrice = new SpecificPrice((int) $data['id_specific_price']);
if (!$specificPrice->duplicate((int) $productId)) {
return false;
}
}
return true;
}
示例2: basename
$target_path = $target_path . basename($_FILES['products']['name']);
if (move_uploaded_file($_FILES['products']['tmp_name'], $target_path)) {
$f = fopen($target_path, 'r');
if ($f) {
$count = 0;
while ($line = fgetcsv($f)) {
if (!is_numeric($line[0])) {
continue;
}
$id_product = (int) $line[0];
$product = new Product($id_product, true, 1);
$newPrice = (double) $line[1];
$mrp = $product->getPriceWithoutReduct();
$product = new Order($id_order);
SpecificPrice::deleteByProductId($id_product);
$specificPriceIDs = SpecificPrice::getIdsByProductId($id_product);
if (count($specificPriceIDs) > 0) {
$specificPrice = new SpecificPrice((int) $specificPriceIDs[0]['id_specific_price']);
//delete discount if the prices are equal update otherwise
if (round($mrp) > round($newPrice)) {
$specificPrice->reduction_type = "amount";
$specificPrice->reduction = $mrp - $newPrice;
$specificPrice->update();
} else {
SpecificPrice::deleteByProductId($id_product);
}
} else {
if (round($mrp) > round($newPrice)) {
$specificPrice = new SpecificPrice();
$specificPrice->id_product = $id_product;
$specificPrice->reduction_type = "amount";