From 15a64f74815402c6abf505cf54934d013d029fd2 Mon Sep 17 00:00:00 2001 From: lucionescu Date: Wed, 6 Sep 2023 18:26:24 +0300 Subject: [PATCH] Fixed get currency if the id is provided --- paylike/paylike.php | 15 ++++++++------- paylike/paylike.xml | 2 +- paylike/tmpl/pay_after.php | 2 +- paylike/tmpl/pay_before_js.php | 11 +++++++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/paylike/paylike.php b/paylike/paylike.php index 77e4223..a6641ec 100755 --- a/paylike/paylike.php +++ b/paylike/paylike.php @@ -33,7 +33,7 @@ class plgVmPaymentPaylike extends vmPSPlugin { - public $version = '2.2.0'; + public $version = '2.2.1'; static $IDS = array(); protected $_isInList = false; function __construct (& $subject, $config) { @@ -118,7 +118,7 @@ function plgVmConfirmedOrder ($cart, $order) { $currency = $method->payment_currency; // backward compatibility - if (Version::MAJOR_VERSION < 4) { + if (is_numeric($method->payment_currency)) { $currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3'); } @@ -369,12 +369,13 @@ function plgVmgetPaymentCurrency ($virtuemart_paymentmethod_id, &$paymentCurrenc } $this->getPaymentCurrency ($method); - $paymentCurrencyId = shopFunctions::getCurrencyIDByName($method->payment_currency); - // backward compatibility - if (Version::MAJOR_VERSION < 4) { + if (is_numeric($method->payment_currency)) { $paymentCurrencyId = $method->payment_currency; + } else { + $paymentCurrencyId = shopFunctions::getCurrencyIDByName($method->payment_currency); } + return; } @@ -592,7 +593,7 @@ function plgVmOnSelfCallFE( $type, $name, &$render ) { $currency = $method->payment_currency; // backward compatibility - if (Version::MAJOR_VERSION < 4) { + if (is_numeric($method->payment_currency)) { $currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3'); } @@ -657,7 +658,7 @@ function plgVmOnSelfCallFE( $type, $name, &$render ) { $currency = $method->payment_currency; // backward compatibility - if (Version::MAJOR_VERSION < 4) { + if (is_numeric($method->payment_currency)) { $currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3'); } diff --git a/paylike/paylike.xml b/paylike/paylike.xml index 3a46398..a7543b5 100755 --- a/paylike/paylike.xml +++ b/paylike/paylike.xml @@ -6,7 +6,7 @@ http://shop.st42.fr Copyright (C) 2018 STUDIO42 France. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 2.2.0 + 2.2.1 Paylike is a popular payment provider. ]]> diff --git a/paylike/tmpl/pay_after.php b/paylike/tmpl/pay_after.php index 2273eff..ee20229 100755 --- a/paylike/tmpl/pay_after.php +++ b/paylike/tmpl/pay_after.php @@ -27,7 +27,7 @@ $currency = $method->payment_currency; // backward compatibility -if (\Joomla\CMS\Version::MAJOR_VERSION < 4) { +if (is_numeric($method->payment_currency)) { $currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3'); } diff --git a/paylike/tmpl/pay_before_js.php b/paylike/tmpl/pay_before_js.php index d350337..139dffe 100755 --- a/paylike/tmpl/pay_before_js.php +++ b/paylike/tmpl/pay_before_js.php @@ -133,8 +133,15 @@ function cancelSubmit() { jQuery(document).ready(function() { - var $container = jQuery(Virtuemart.containerSelector), - paymentDone = false; + let $container = ''; + let paymentDone = false; + + if (Virtuemart.containerSelector) { + $container = jQuery(Virtuemart.containerSelector) + } else { + $container = jQuery('#cart-view') + } + $container.find('#checkoutForm').on('submit',function(e) { // payment is done, then submit if(paymentDone === true) return;