本文整理汇总了PHP中oledrion_utils::doNotAcceptNegativeAmounts方法的典型用法代码示例。如果您正苦于以下问题:PHP oledrion_utils::doNotAcceptNegativeAmounts方法的具体用法?PHP oledrion_utils::doNotAcceptNegativeAmounts怎么用?PHP oledrion_utils::doNotAcceptNegativeAmounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oledrion_utils
的用法示例。
在下文中一共展示了oledrion_utils::doNotAcceptNegativeAmounts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: computeCart
//.........这里部分代码省略.........
switch ($rule->disc_price_type) {
case OLEDRION_DISCOUNT_PRICE_TYPE1:
// Montant dégressif selon les quantités
if ($quantity >= $rule->disc_price_degress_l1qty1 && $quantity <= $rule->disc_price_degress_l1qty2) {
$discountedPrice = floatval($rule->getVar('disc_price_degress_l1total', 'n'));
}
if ($quantity >= $rule->disc_price_degress_l2qty1 && $quantity <= $rule->disc_price_degress_l2qty2) {
$discountedPrice = floatval($rule->getVar('disc_price_degress_l2total', 'n'));
}
if ($quantity >= $rule->disc_price_degress_l3qty1 && $quantity <= $rule->disc_price_degress_l3qty2) {
$discountedPrice = floatval($rule->getVar('disc_price_degress_l3total', 'n'));
}
if ($quantity >= $rule->disc_price_degress_l4qty1 && $quantity <= $rule->disc_price_degress_l4qty2) {
$discountedPrice = floatval($rule->getVar('disc_price_degress_l4total', 'n'));
}
if ($quantity >= $rule->disc_price_degress_l5qty1 && $quantity <= $rule->disc_price_degress_l5qty2) {
$discountedPrice = floatval($rule->getVar('disc_price_degress_l5total', 'n'));
}
$reduction = $rule->disc_description;
$discountsCount++;
break;
case OLEDRION_DISCOUNT_PRICE_TYPE2:
// D'un montant ou d'un pourcentage
if ($rule->disc_price_amount_on == OLEDRION_DISCOUNT_PRICE_AMOUNT_ON_PRODUCT) {
// Réduction sur le produit
if ($rule->disc_price_amount_type == OLEDRION_DISCOUNT_PRICE_REDUCE_PERCENT) {
// Réduction en pourcentage
$discountedPrice = $this->getDiscountedPrice($discountedPrice, $rule->getVar('disc_price_amount_amount', 'n'));
} elseif ($rule->disc_price_amount_type == OLEDRION_DISCOUNT_PRICE_REDUCE_MONEY) {
// Réduction d'un montant en euros
$discountedPrice -= floatval($rule->getVar('disc_price_amount_amount', 'n'));
}
// Pas de montants négatifs
oledrion_utils::doNotAcceptNegativeAmounts($discountedPrice);
$reduction = $rule->disc_description;
$discountsCount++;
} elseif ($rule->disc_price_amount_on == OLEDRION_DISCOUNT_PRICE_AMOUNT_ON_CART) {
// Règle à appliquer sur le panier
if (!isset($this->rulesForTheWhole[$rule->disc_id])) {
$this->rulesForTheWhole[$rule->disc_id] = $rule;
}
}
break;
}
// On passe au montant des frais de port
switch ($rule->disc_shipping_type) {
case OLEDRION_DISCOUNT_SHIPPING_TYPE1:
// A payer dans leur intégralité, rien à faire
break;
case OLEDRION_DISCOUNT_SHIPPING_TYPE2:
// Totalement gratuits si le client commande plus de X euros d'achat
if ($this->totalAmountBeforeDiscounts > $rule->disc_shipping_free_morethan) {
$discountedShipping = 0.0;
}
break;
case OLEDRION_DISCOUNT_SHIPPING_TYPE3:
// Frais de port réduits de X euros si la commande est > x
if ($this->totalAmountBeforeDiscounts > $rule->disc_shipping_reduce_cartamount) {
$discountedShipping -= floatval($rule->getVar('disc_shipping_reduce_amount', 'n'));
}
// Pas de montants négatifs
oledrion_utils::doNotAcceptNegativeAmounts($discountedShipping);
break;
case OLEDRION_DISCOUNT_SHIPPING_TYPE4:
// Frais de port dégressifs
if ($quantity >= $rule->disc_shipping_degress_l1qty1 && $quantity <= $rule->disc_shipping_degress_l1qty2) {