本文整理汇总了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";