From b7328a2be1aa7f8f04c2aba15c2cef4662422ab0 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 19 Nov 2024 11:05:14 +0200 Subject: [PATCH] improved attribute group check --- mollie.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mollie.php b/mollie.php index fa475f108..23c6c6b20 100755 --- a/mollie.php +++ b/mollie.php @@ -26,13 +26,13 @@ use Mollie\Repository\PaymentMethodRepositoryInterface; use Mollie\Service\ExceptionService; use Mollie\ServiceProvider\LeagueServiceContainerProvider; +use Mollie\Subscription\Config\Config as SubscriptionConfig; use Mollie\Subscription\Handler\CustomerAddressUpdateHandler; use Mollie\Subscription\Handler\UpdateSubscriptionCarrierHandler; use Mollie\Subscription\Install\AttributeInstaller; use Mollie\Subscription\Install\DatabaseTableInstaller; use Mollie\Subscription\Install\HookInstaller; use Mollie\Subscription\Install\Installer; -use Mollie\Subscription\Config\Config as SubscriptionConfig; use Mollie\Subscription\Provider\SubscriptionProductProvider; use Mollie\Subscription\Repository\LanguageRepository as LanguageAdapter; use Mollie\Subscription\Repository\RecurringOrderRepositoryInterface; @@ -1128,13 +1128,14 @@ public function hookActionAjaxDieCartControllerDisplayAjaxUpdateBefore(array $pa $isSubscriptionEnabled = Configuration::get(Config::MOLLIE_SUBSCRIPTION_ENABLED); $groups = Tools::getValue('group'); - if (!(bool)$isSubscriptionEnabled || !is_array($groups)) { + if (!(bool) $isSubscriptionEnabled || !is_array($groups)) { return; } $subscriptionGroup = Configuration::get(SubscriptionConfig::SUBSCRIPTION_ATTRIBUTE_GROUP); - if (!in_array($subscriptionGroup, $groups, true)) { + // Note: groups = ['attribute_group_id => 'attribute_id'] + if (!array_key_exists($subscriptionGroup, $groups)) { return; }