ref #87349 Added automatic catalog generation when changing 'Activate the binding via sku (xml)' (#327)
This commit is contained in:
parent
498646c10a
commit
9ea8818e5b
@ -1,3 +1,6 @@
|
||||
## 2024-04-19 4.7.5
|
||||
* Added automatic catalog generation when changing "Activate the binding via sku (xml)"
|
||||
|
||||
## 2024-02-29 4.7.4
|
||||
* Fixed an error when transferring abandoned carts
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
После активации опции при генерации каталога в нем появится параметр xmlID *(артикул)*.
|
||||
|
||||
С версии 4.7.5 после активации/деактивации опции и сохранении настроек, каталог будет сгенерирован автоматически.
|
||||
|
||||
**xmlID** - внешний идентификатор товара, элемент не является обязательным. В случае, если интернет-магазин использует выгрузку номенклатуры товаров из складской системы *(1С, МойСклад)*, то значение этого элемента соответствует идентификатору товара в данной системе. Активируется, когда клиенты используют Woocommerce + MC/1C.
|
||||
|
||||
### Недавние обновления:
|
||||
@ -52,4 +54,4 @@ function changeProductInfo($productData, $wcProduct)
|
||||
|
||||
return $productData;
|
||||
}
|
||||
```
|
||||
```
|
||||
|
15
src/assets/js/retailcrm-module-settings.js
Normal file
15
src/assets/js/retailcrm-module-settings.js
Normal file
@ -0,0 +1,15 @@
|
||||
jQuery(function () {
|
||||
document.querySelector('#woocommerce_integration-retailcrm_bind_by_sku').onchange = function() {
|
||||
let useXmlId = this.checked ? 'yes' : 'no';
|
||||
|
||||
document.querySelector('.submit').onclick = function() {
|
||||
jQuery.ajax({
|
||||
url: AdminUrl.url + '/admin-ajax.php?action=generate_icml',
|
||||
method: 'POST',
|
||||
timeout: 0,
|
||||
data: {useXmlId: useXmlId},
|
||||
dataType: 'json'
|
||||
})
|
||||
}
|
||||
};
|
||||
})
|
@ -283,6 +283,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
}
|
||||
|
||||
$retailCrmIcml = new WC_Retailcrm_Icml();
|
||||
|
||||
// Generate new ICML catalog, because change bind_by_sku
|
||||
if (isset($_POST['useXmlId'])) {
|
||||
$retailCrmIcml->changeBindBySku($_POST['useXmlId']);
|
||||
}
|
||||
|
||||
$retailCrmIcml->generate();
|
||||
|
||||
$this->uploadCatalog($infoApiKey);
|
||||
@ -634,8 +640,14 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
||||
*/
|
||||
private function include_js_scripts_for_admin()
|
||||
{
|
||||
$jsScripts = ['retailcrm-export', 'retailcrm-cron-info','retailcrm-meta-fields'];
|
||||
$wpAdminUrl = ['url' => get_admin_url()];
|
||||
$jsScripts = [
|
||||
'retailcrm-export',
|
||||
'retailcrm-cron-info',
|
||||
'retailcrm-meta-fields',
|
||||
'retailcrm-module-settings',
|
||||
];
|
||||
|
||||
$wpAdminUrl = ['url' => get_admin_url()];
|
||||
$jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/';
|
||||
|
||||
foreach ($jsScripts as $scriptName) {
|
||||
|
@ -27,9 +27,13 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
||||
];
|
||||
|
||||
protected $shop;
|
||||
|
||||
protected $file;
|
||||
|
||||
protected $tmpFile;
|
||||
|
||||
protected $settings;
|
||||
|
||||
protected $icmlWriter;
|
||||
|
||||
/**
|
||||
@ -45,6 +49,11 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
||||
$this->icmlWriter = new WC_Retailcrm_Icml_Writer($this->tmpFile);
|
||||
}
|
||||
|
||||
public function changeBindBySku($useXmlId)
|
||||
{
|
||||
$this->settings['bind_by_sku'] = $useXmlId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate ICML catalog.
|
||||
*/
|
||||
@ -201,21 +210,21 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
||||
|
||||
$dimensions = '';
|
||||
|
||||
if ($product->get_length() != '') {
|
||||
if ($product->get_length() !== '') {
|
||||
$dimensions = wc_get_dimension($product->get_length(), 'cm');
|
||||
}
|
||||
|
||||
if ($product->get_width() != '') {
|
||||
if ($product->get_width() !== '') {
|
||||
$dimensions .= '/' . wc_get_dimension($product->get_width(), 'cm');
|
||||
}
|
||||
|
||||
if ($product->get_height() != '') {
|
||||
if ($product->get_height() !== '') {
|
||||
$dimensions .= '/' . wc_get_dimension($product->get_height(), 'cm');
|
||||
}
|
||||
|
||||
$weight = '';
|
||||
|
||||
if ($product->get_weight() != '') {
|
||||
if ($product->get_weight() !== '') {
|
||||
$weight = wc_get_weight($product->get_weight(), 'kg');
|
||||
}
|
||||
|
||||
@ -246,7 +255,7 @@ if (!class_exists('WC_Retailcrm_Icml')) :
|
||||
'tax' => isset($tax) ? $tax['rate'] : 'none'
|
||||
];
|
||||
|
||||
if ($product->get_sku() != '') {
|
||||
if ($product->get_sku() !== '') {
|
||||
$params[] = ['code' => 'article', 'name' => 'Article', 'value' => $product->get_sku()];
|
||||
|
||||
if (isset($this->settings['bind_by_sku']) && $this->settings['bind_by_sku'] == WC_Retailcrm_Base::YES) {
|
||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
||||
Requires PHP: 7.0
|
||||
Requires at least: 5.3
|
||||
Tested up to: 6.4
|
||||
Stable tag: 4.7.4
|
||||
Stable tag: 4.7.5
|
||||
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.7.5 =
|
||||
* Added automatic catalog generation when changing 'Activate the binding via sku (xml)'
|
||||
|
||||
= 4.7.4 =
|
||||
* Fixed an error when transferring abandoned carts
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Description: Integration plugin for WooCommerce & Simla.com
|
||||
* Author: RetailDriver LLC
|
||||
* Author URI: http://retailcrm.pro/
|
||||
* Version: 4.7.4
|
||||
* Version: 4.7.5
|
||||
* Tested up to: 6.4
|
||||
* WC requires at least: 5.4
|
||||
* WC tested up to: 8.5
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||
*
|
||||
* @version 4.7.4
|
||||
* @version 4.7.5
|
||||
*
|
||||
* @package RetailCRM
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user