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