1
0
mirror of synced 2025-02-06 18:19:24 +03:00

ref #87349 Added automatic catalog generation when changing 'Activate the binding via sku (xml)' (#327)

This commit is contained in:
Uryvskiy Dima 2024-04-22 09:01:59 +03:00 committed by GitHub
parent 498646c10a
commit 9ea8818e5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 56 additions and 12 deletions

View File

@ -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 ## 2024-02-29 4.7.4
* Fixed an error when transferring abandoned carts * Fixed an error when transferring abandoned carts

View File

@ -1 +1 @@
4.7.4 4.7.5

View File

@ -23,6 +23,8 @@
После активации опции при генерации каталога в нем появится параметр xmlID *(артикул)*. После активации опции при генерации каталога в нем появится параметр xmlID *(артикул)*.
С версии 4.7.5 после активации/деактивации опции и сохранении настроек, каталог будет сгенерирован автоматически.
**xmlID** - внешний идентификатор товара, элемент не является обязательным. В случае, если интернет-магазин использует выгрузку номенклатуры товаров из складской системы *(1С, МойСклад)*, то значение этого элемента соответствует идентификатору товара в данной системе. Активируется, когда клиенты используют Woocommerce + MC/1C. **xmlID** - внешний идентификатор товара, элемент не является обязательным. В случае, если интернет-магазин использует выгрузку номенклатуры товаров из складской системы *(1С, МойСклад)*, то значение этого элемента соответствует идентификатору товара в данной системе. Активируется, когда клиенты используют Woocommerce + MC/1C.
### Недавние обновления: ### Недавние обновления:

View 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'
})
}
};
})

View File

@ -283,6 +283,12 @@ if (!class_exists('WC_Retailcrm_Base')) {
} }
$retailCrmIcml = new WC_Retailcrm_Icml(); $retailCrmIcml = new WC_Retailcrm_Icml();
// Generate new ICML catalog, because change bind_by_sku
if (isset($_POST['useXmlId'])) {
$retailCrmIcml->changeBindBySku($_POST['useXmlId']);
}
$retailCrmIcml->generate(); $retailCrmIcml->generate();
$this->uploadCatalog($infoApiKey); $this->uploadCatalog($infoApiKey);
@ -634,7 +640,13 @@ if (!class_exists('WC_Retailcrm_Base')) {
*/ */
private function include_js_scripts_for_admin() private function include_js_scripts_for_admin()
{ {
$jsScripts = ['retailcrm-export', 'retailcrm-cron-info','retailcrm-meta-fields']; $jsScripts = [
'retailcrm-export',
'retailcrm-cron-info',
'retailcrm-meta-fields',
'retailcrm-module-settings',
];
$wpAdminUrl = ['url' => get_admin_url()]; $wpAdminUrl = ['url' => get_admin_url()];
$jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/'; $jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/';

View File

@ -27,9 +27,13 @@ if (!class_exists('WC_Retailcrm_Icml')) :
]; ];
protected $shop; protected $shop;
protected $file; protected $file;
protected $tmpFile; protected $tmpFile;
protected $settings; protected $settings;
protected $icmlWriter; protected $icmlWriter;
/** /**
@ -45,6 +49,11 @@ if (!class_exists('WC_Retailcrm_Icml')) :
$this->icmlWriter = new WC_Retailcrm_Icml_Writer($this->tmpFile); $this->icmlWriter = new WC_Retailcrm_Icml_Writer($this->tmpFile);
} }
public function changeBindBySku($useXmlId)
{
$this->settings['bind_by_sku'] = $useXmlId;
}
/** /**
* Generate ICML catalog. * Generate ICML catalog.
*/ */
@ -201,21 +210,21 @@ if (!class_exists('WC_Retailcrm_Icml')) :
$dimensions = ''; $dimensions = '';
if ($product->get_length() != '') { if ($product->get_length() !== '') {
$dimensions = wc_get_dimension($product->get_length(), 'cm'); $dimensions = wc_get_dimension($product->get_length(), 'cm');
} }
if ($product->get_width() != '') { if ($product->get_width() !== '') {
$dimensions .= '/' . wc_get_dimension($product->get_width(), 'cm'); $dimensions .= '/' . wc_get_dimension($product->get_width(), 'cm');
} }
if ($product->get_height() != '') { if ($product->get_height() !== '') {
$dimensions .= '/' . wc_get_dimension($product->get_height(), 'cm'); $dimensions .= '/' . wc_get_dimension($product->get_height(), 'cm');
} }
$weight = ''; $weight = '';
if ($product->get_weight() != '') { if ($product->get_weight() !== '') {
$weight = wc_get_weight($product->get_weight(), 'kg'); $weight = wc_get_weight($product->get_weight(), 'kg');
} }
@ -246,7 +255,7 @@ if (!class_exists('WC_Retailcrm_Icml')) :
'tax' => isset($tax) ? $tax['rate'] : 'none' 'tax' => isset($tax) ? $tax['rate'] : 'none'
]; ];
if ($product->get_sku() != '') { if ($product->get_sku() !== '') {
$params[] = ['code' => 'article', 'name' => 'Article', 'value' => $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) { if (isset($this->settings['bind_by_sku']) && $this->settings['bind_by_sku'] == WC_Retailcrm_Base::YES) {

View File

@ -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.4 Tested up to: 6.4
Stable tag: 4.7.4 Stable tag: 4.7.5
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.7.5 =
* Added automatic catalog generation when changing 'Activate the binding via sku (xml)'
= 4.7.4 = = 4.7.4 =
* Fixed an error when transferring abandoned carts * Fixed an error when transferring abandoned carts

View File

@ -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.7.4 * Version: 4.7.5
* Tested up to: 6.4 * Tested up to: 6.4
* WC requires at least: 5.4 * WC requires at least: 5.4
* WC tested up to: 8.5 * WC tested up to: 8.5

View File

@ -16,7 +16,7 @@
* *
* @link https://wordpress.org/plugins/woo-retailcrm/ * @link https://wordpress.org/plugins/woo-retailcrm/
* *
* @version 4.7.4 * @version 4.7.5
* *
* @package RetailCRM * @package RetailCRM
*/ */