Skip to content
Code-Schnipsel Gruppen Projekte
Commit 77001f0b erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: candyman-gmbh/projektplanung#121 - discount usable checks

Übergeordneter 5eb45868
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -7,6 +7,7 @@
use QUI\ERP\Order\Basket\Basket;
use QUI\ERP\Order\Basket\BasketGuest;
use QUI\ERP\Coupons\Handler as CouponsHandler;
use QUI\ERP\Discount\EventHandling as DiscountEvents;
/**
* Class Events
......@@ -109,6 +110,9 @@ public static function onQuiqqerOrderBasketToOrder(
}
$PriceFactors = $Products->getPriceFactors();
$products = $Products->toArray();
$productCount = $Products->count();
$subSum = $products['calculations']['subSum'];
foreach ($coupons as $coupon) {
/* @var $Coupon CouponCode */
......@@ -127,6 +131,14 @@ public static function onQuiqqerOrderBasketToOrder(
$discounts = $Coupon->getDiscounts();
foreach ($discounts as $Discount) {
if (!DiscountEvents::isDiscountUsableWithQuantity($Discount, $productCount)) {
continue;
}
if (!DiscountEvents::isDiscountUsableWithPurchaseValue($Discount, $subSum)) {
continue;
}
$PriceFactor = $Discount->toPriceFactor(null, $Order->getCustomer());
$PriceFactor->setTitle(
QUI::getLocale()->get('quiqqer/coupons', 'coupon.discount.title', [
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren