From 400e67fac48c16049f14023568e42994c17313f8 Mon Sep 17 00:00:00 2001 From: Michael Danielczok <michael@pcsg.de> Date: Tue, 4 Mar 2025 10:13:00 +0100 Subject: [PATCH] refactor: disabled quiqqer message on coupon code error Related: quiqqer/coupons#20 Acked-by: Henning Leutz <leutz@pcsg.de> --- ajax/frontend/redeem.php | 40 ------------------------ bin/frontend/classes/CouponCodes.js | 3 +- bin/frontend/controls/CouponCodeInput.js | 17 ---------- 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/ajax/frontend/redeem.php b/ajax/frontend/redeem.php index 9eef139..02f080a 100644 --- a/ajax/frontend/redeem.php +++ b/ajax/frontend/redeem.php @@ -32,9 +32,7 @@ function ($code, $orderHash) { } catch (QUI\ERP\Coupons\CouponCodeException $Exception) { QUI\System\Log::writeDebugException($Exception); -// QUI::getMessagesHandler()->addError($Exception->getMessage()); throw $Exception; -// return false; } catch (Exception $Exception) { QUI\System\Log::writeException($Exception); @@ -42,15 +40,6 @@ function ($code, $orderHash) { 'quiqqer/coupons', 'message.ajax.general_error' ]); - -// QUI::getMessagesHandler()->addError( -// QUI::getLocale()->get( -// 'quiqqer/coupons', -// 'message.ajax.general_error' -// ) -// ); - -// return false; } $Order = QUI\ERP\Order\Handler::getInstance()->getOrderByHash($orderHash); @@ -67,15 +56,6 @@ function ($code, $orderHash) { 'quiqqer/coupons', 'exception.CouponCode.discounts_invalid' ]); - -// QUI::getMessagesHandler()->addError( -// QUI::getLocale()->get( -// 'quiqqer/coupons', -// 'exception.CouponCode.discounts_invalid' -// ) -// ); -// -// return false; } if ($Discount->getAttribute('scope') === QUI\ERP\Discount\Handler::DISCOUNT_SCOPE_GRAND_TOTAL) { @@ -84,15 +64,6 @@ function ($code, $orderHash) { 'quiqqer/coupons', 'exception.CouponCode.discounts_invalid' ]); - -// QUI::getMessagesHandler()->addError( -// QUI::getLocale()->get( -// 'quiqqer/coupons', -// 'exception.CouponCode.discounts_invalid' -// ) -// ); -// -// return false; } continue; @@ -103,15 +74,6 @@ function ($code, $orderHash) { 'quiqqer/coupons', 'exception.CouponCode.discounts_invalid' ]); - -// QUI::getMessagesHandler()->addError( -// QUI::getLocale()->get( -// 'quiqqer/coupons', -// 'exception.CouponCode.discounts_invalid' -// ) -// ); -// -// return false; } } @@ -133,8 +95,6 @@ function ($code, $orderHash) { if ($Order instanceof QUI\ERP\Order\OrderInProcess) { $CouponCode->addToOrder($Order); } - -// return true; }, ['code', 'orderHash'] ); diff --git a/bin/frontend/classes/CouponCodes.js b/bin/frontend/classes/CouponCodes.js index cea109e..d0076ba 100644 --- a/bin/frontend/classes/CouponCodes.js +++ b/bin/frontend/classes/CouponCodes.js @@ -32,7 +32,8 @@ define('package/quiqqer/coupons/bin/frontend/classes/CouponCodes', [ 'package': pkg, code: code, orderHash: orderHash, - onError: reject + onError: reject, + showError: false // disable quiqqer message in frontend }); }); } diff --git a/bin/frontend/controls/CouponCodeInput.js b/bin/frontend/controls/CouponCodeInput.js index 174c5c5..df764ed 100644 --- a/bin/frontend/controls/CouponCodeInput.js +++ b/bin/frontend/controls/CouponCodeInput.js @@ -219,22 +219,6 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [ OrderProcess.Loader.show(); - // OrderProcess.getOrder().then(function(orderHash) { - // return CouponCodes.addCouponCodeToBasket(code, orderHash); - // }).then(function(redeemed) { - // self.$running = false; - // - // if (redeemed === false) { - // OrderProcess.Loader.hide(); - // self.Loader.hide(); - // return; - // } - // - // self.$addCouponCodeToSession(code).then(function() { - // OrderProcess.reload(); - // }); - // }); - OrderProcess.getOrder().then(function(orderHash) { CouponCodes.addCouponCodeToBasket(code, orderHash).then(() => { self.$running = false; @@ -244,7 +228,6 @@ define('package/quiqqer/coupons/bin/frontend/controls/CouponCodeInput', [ }); }).catch((err) => { OrderProcess.Loader.hide(); - self.Loader.hide(); self.handleError(err); }); }); -- GitLab