From c7d6c6cf322aad103dbfd170184a975cee4eba30 Mon Sep 17 00:00:00 2001 From: gleemand Date: Mon, 2 Aug 2021 11:58:01 +0300 Subject: [PATCH] Changed the way of receiving payment modules from PS --- doc/1. Setup/Configuration/Payment types.md | 5 +++++ retailcrm/lib/RetailcrmReferences.php | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 doc/1. Setup/Configuration/Payment types.md diff --git a/doc/1. Setup/Configuration/Payment types.md b/doc/1. Setup/Configuration/Payment types.md new file mode 100644 index 0000000..aec6b54 --- /dev/null +++ b/doc/1. Setup/Configuration/Payment types.md @@ -0,0 +1,5 @@ +# Payment types + +## Модули оплаты + +На вкладке `Способы оплаты` отображаются активные модули оплаты, унаследованные от класса `PaymentModule` и модули, возвращаемые методом `PaymentModule::getInstalledPaymentModules()`. \ No newline at end of file diff --git a/retailcrm/lib/RetailcrmReferences.php b/retailcrm/lib/RetailcrmReferences.php index 81d29b9..8283e79 100644 --- a/retailcrm/lib/RetailcrmReferences.php +++ b/retailcrm/lib/RetailcrmReferences.php @@ -214,9 +214,17 @@ class RetailcrmReferences * Get all modules then select only payment ones */ $modules = RetailCRM::getCachedCmsModulesList(); + $allPaymentModules = PaymentModule::getInstalledPaymentModules(); + $paymentModulesIds = array(); + + foreach ($allPaymentModules as $module) { + $paymentModulesIds[] = $module['id_module']; + } foreach ($modules as $module) { - if (!empty($module->parent_class) && $module->parent_class == 'PaymentModule') { + if ((!empty($module->parent_class) && $module->parent_class == 'PaymentModule') + || in_array($module->id, $paymentModulesIds) + ) { if ($module->id) { $module_id = (int) $module->id;