From ac8dafb90b732d6c5e24cf0e8ccf696d77c7f603 Mon Sep 17 00:00:00 2001 From: woutse Date: Mon, 16 Sep 2024 11:46:27 +0200 Subject: [PATCH 1/2] Added check on quota existence --- .../web/js/view/payment/method-renderer/default.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/view/frontend/web/js/view/payment/method-renderer/default.js b/view/frontend/web/js/view/payment/method-renderer/default.js index bc6cddcb..f709c7bd 100755 --- a/view/frontend/web/js/view/payment/method-renderer/default.js +++ b/view/frontend/web/js/view/payment/method-renderer/default.js @@ -84,6 +84,9 @@ define( return true; }, getCurrentShippingMethod: function () { + if (quote.shippingMethod() === null || quote.shippingMethod() === undefined) { + return; + } var carrier_code = typeof quote.shippingMethod().carrier_code !== 'undefined' ? quote.shippingMethod().carrier_code + '_' : ''; var method_code = typeof quote.shippingMethod().method_code !== 'undefined' ? quote.shippingMethod().method_code : ''; var currentShippingMethod = carrier_code + method_code; @@ -258,7 +261,7 @@ define( afterPlaceOrder: function () { window.location.replace(url.build('paynl/checkout/redirect?nocache=' + (new Date().getTime()))); }, - getCustomField: function (fieldname) { + getCustomField: function (fieldname) { var customFields = []; if (quote.billingAddress.hasOwnProperty('_latestValue') && typeof quote.billingAddress._latestValue !== 'undefined' && quote.billingAddress._latestValue !== null) { $.each(quote.billingAddress._latestValue.customAttributes, function (i, l) { @@ -273,15 +276,15 @@ define( var cocnumber_val = (this.cocnumber != null && this.cocnumber.length > 0) ? this.cocnumber : this.getCustomField('paynl_coc_number'); var vatnumber_val = (this.vatnumber != null && this.vatnumber.length > 0) ? this.vatnumber : this.getCustomField('paynl_vat_number'); - var dob_format = ''; - + var dob_format = ''; + if (dateofbirth_val != null) { var dob = new Date(dateofbirth_val) var dd = dob.getDate(), mm = dob.getMonth() + 1, yyyy = dob.getFullYear() dd = (dd < 10) ? '0' + dd : dd mm = (mm < 10) ? '0' + mm : mm dob_format = dd + '-' + mm + '-' + yyyy - } + } return { 'method': this.item.method, From 5f345680a7a3e9f52268b77af37307496b92c459 Mon Sep 17 00:00:00 2001 From: woutse Date: Mon, 16 Sep 2024 11:55:11 +0200 Subject: [PATCH 2/2] Code polish --- ViewModel/FastCheckout.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ViewModel/FastCheckout.php b/ViewModel/FastCheckout.php index a8ce4d52..13a33804 100644 --- a/ViewModel/FastCheckout.php +++ b/ViewModel/FastCheckout.php @@ -31,24 +31,30 @@ public function __construct( } /** + * getVisibility + * * @return boolean */ public function getVisibility() { $store = $this->storeManager->getStore(); - if ($this->session->isLoggedIn() && $store->getConfig('payment/paynl_payment_ideal/fast_checkout_guest_only') == 1) { + if ($this->session->isLoggedIn() && + $store->getConfig('payment/paynl_payment_ideal/fast_checkout_guest_only') == 1) { return false; } return true; } /** + * minicartEnabled + * * @return boolean */ public function minicartEnabled() { $store = $this->storeManager->getStore(); - if ($store->getConfig('payment/paynl_payment_ideal/fast_checkout_minicart_enabled') == 1 && $this->getVisibility()) { + if ($store->getConfig('payment/paynl_payment_ideal/fast_checkout_minicart_enabled') == 1 + && $this->getVisibility()) { return true; } return false;