ref #90086 Types of deliveries and payments are displayed only for available stores
This commit is contained in:
commit
79ca29fa03
@ -1,3 +1,6 @@
|
||||
## 2022-05-29 4.6.3
|
||||
* Types of deliveries and payments are displayed only for available stores
|
||||
|
||||
## 2022-05-17 4.6.2
|
||||
* Modified method getting an address by history
|
||||
|
||||
|
@ -188,19 +188,30 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping options
|
||||
*/
|
||||
$shipping_option_list = [];
|
||||
$retailcrm_shipping_list = $this->apiClient->deliveryTypesList();
|
||||
$crmSite = $this->apiClient->getSingleSiteForKey();
|
||||
|
||||
if (!empty($retailcrm_shipping_list) && $retailcrm_shipping_list->isSuccessful()) {
|
||||
foreach ($retailcrm_shipping_list['deliveryTypes'] as $retailcrm_shipping_type) {
|
||||
if ($retailcrm_shipping_type['active'] == false) {
|
||||
/**
|
||||
* Delivery options
|
||||
*/
|
||||
$crmDeliveryList = $this->apiClient->deliveryTypesList();
|
||||
|
||||
if ($crmDeliveryList instanceof WC_Retailcrm_Response && $crmDeliveryList->isSuccessful()) {
|
||||
$shippingOptionList = [];
|
||||
|
||||
foreach ($crmDeliveryList['deliveryTypes'] as $crmDelivery) {
|
||||
if ($crmDelivery['active'] === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$shipping_option_list[$retailcrm_shipping_type['code']] = $retailcrm_shipping_type['name'];
|
||||
if (
|
||||
isset($crmDelivery['sites'])
|
||||
&& $crmDelivery['sites'] !== []
|
||||
&& in_array($crmSite, $crmDelivery['sites']) === false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$shippingOptionList[$crmDelivery['code']] = $crmDelivery['name'];
|
||||
}
|
||||
|
||||
$wc_shipping_list = get_wc_shipping_methods();
|
||||
@ -220,7 +231,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
'css' => 'min-width:350px;',
|
||||
'class' => 'select',
|
||||
'type' => 'select',
|
||||
'options' => $shipping_option_list,
|
||||
'options' => $shippingOptionList,
|
||||
'desc_tip' => true,
|
||||
];
|
||||
}
|
||||
@ -232,23 +243,31 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
*/
|
||||
$crmPaymentsList = $this->apiClient->paymentTypesList();
|
||||
|
||||
if (!empty($crmPaymentsList) && $crmPaymentsList->isSuccessful()) {
|
||||
$paymentsList = [];
|
||||
if ($crmPaymentsList instanceof WC_Retailcrm_Response && $crmPaymentsList->isSuccessful()) {
|
||||
$paymentOptionList = [];
|
||||
$integrationPayments = [];
|
||||
|
||||
foreach ($crmPaymentsList['paymentTypes'] as $crmPaymentType) {
|
||||
if ($crmPaymentType['active'] == false) {
|
||||
foreach ($crmPaymentsList['paymentTypes'] as $crmPayment) {
|
||||
if ($crmPayment['active'] === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($crmPaymentType['integrationModule'])) {
|
||||
$integrationPayments['code'][] = $crmPaymentType['code'];
|
||||
$integrationPayments['name'][] = $crmPaymentType['name'];
|
||||
|
||||
$crmPaymentType['name'] .= ' - ' . __('Integration payment', 'retailcrm');
|
||||
if (
|
||||
isset($crmPayment['sites'])
|
||||
&& $crmPayment['sites'] !== []
|
||||
&& in_array($crmSite, $crmPayment['sites']) === false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$paymentsList[$crmPaymentType['code']] = $crmPaymentType['name'];
|
||||
if (isset($crmPayment['integrationModule'])) {
|
||||
$integrationPayments['code'][] = $crmPayment['code'];
|
||||
$integrationPayments['name'][] = $crmPayment['name'];
|
||||
|
||||
$crmPayment['name'] .= ' - ' . __('Integration payment', 'retailcrm');
|
||||
}
|
||||
|
||||
$paymentOptionList[$crmPayment['code']] = $crmPayment['name'];
|
||||
}
|
||||
|
||||
$wc_payment = WC_Payment_Gateways::instance();
|
||||
@ -282,7 +301,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
||||
'type' => 'select',
|
||||
'title' => __($title, 'woocommerce'),
|
||||
'class' => 'select',
|
||||
'options' => $paymentsList,
|
||||
'options' => $paymentOptionList,
|
||||
'desc_tip' => true,
|
||||
'description' => __($description, 'woocommerce'),
|
||||
];
|
||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
||||
Requires PHP: 7.0
|
||||
Requires at least: 5.3
|
||||
Tested up to: 6.0
|
||||
Stable tag: 4.6.2
|
||||
Stable tag: 4.6.3
|
||||
License: GPLv1 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
||||
|
||||
@ -82,6 +82,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
|
||||
|
||||
|
||||
== Changelog ==
|
||||
= 4.6.3 =
|
||||
* Types of deliveries and payments are displayed only for available stores
|
||||
|
||||
= 4.6.2 =
|
||||
* Modified method getting an address by history
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Description: Integration plugin for WooCommerce & Simla.com
|
||||
* Author: RetailDriver LLC
|
||||
* Author URI: http://retailcrm.pro/
|
||||
* Version: 4.6.2
|
||||
* Version: 4.6.3
|
||||
* Tested up to: 6.0
|
||||
* WC requires at least: 5.4
|
||||
* WC tested up to: 6.9
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||
*
|
||||
* @version 4.6.2
|
||||
* @version 4.6.3
|
||||
*
|
||||
* @package RetailCRM
|
||||
*/
|
||||
|
@ -75,6 +75,18 @@ class DataBaseRetailCrm
|
||||
],
|
||||
'active' => true
|
||||
],
|
||||
[
|
||||
'name' => 'payment4',
|
||||
'code' => 'payment4',
|
||||
'active' => true,
|
||||
'sites' => ['prestaShop']
|
||||
],
|
||||
[
|
||||
'name' => 'payment5',
|
||||
'code' => 'payment5',
|
||||
'active' => true,
|
||||
'sites' => ['woocommerce']
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
@ -93,6 +105,18 @@ class DataBaseRetailCrm
|
||||
'name' => 'delivery2',
|
||||
'code' => 'delivery2',
|
||||
'active' => false
|
||||
],
|
||||
[
|
||||
'name' => 'delivery3',
|
||||
'code' => 'delivery3',
|
||||
'active' => true,
|
||||
'sites' => ['prestaShop']
|
||||
],
|
||||
[
|
||||
'name' => 'delivery4',
|
||||
'code' => 'delivery4',
|
||||
'active' => true,
|
||||
'sites' => ['woocommerce']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -36,10 +36,12 @@ class WC_Retailcrm_Base_Test extends WC_Retailcrm_Test_Case_Helper
|
||||
'paymentTypesList',
|
||||
'statusesList',
|
||||
'customFieldsList',
|
||||
'getSingleSiteForKey',
|
||||
]
|
||||
)
|
||||
->getMock();
|
||||
|
||||
$this->setMockResponse($this->apiMock, 'getSingleSiteForKey', ['woocommerce']);
|
||||
$this->setMockOrderMethods();
|
||||
$this->setMockDeliveryTypes();
|
||||
$this->setMockPaymentTypes();
|
||||
|
Loading…
x
Reference in New Issue
Block a user