ref #95389 Support for services in ICML (#221)

This commit is contained in:
Uryvskiy Dima 2024-05-13 09:36:16 +03:00 committed by GitHub
parent 3d6edb8b97
commit bf9f07a0a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 35 additions and 12 deletions

View File

@ -14,20 +14,20 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.1'
branch: '1.7.7.0'
composerv1: 1
- php-version: '7.2'
branch: '1.7.7.0'
composerv1: 1
# - php-version: '7.1' - Warning: Invalid argument supplied for foreach() in /home/runner/work/prestashop-module/PrestaShop/classes/Language.php
# branch: '1.7.7.0'
# composerv1: 1
# - php-version: '7.2' - Warning: Invalid argument supplied for foreach() in /home/runner/work/prestashop-module/PrestaShop/classes/Language.php
# branch: '1.7.7.0'
# composerv1: 1
- php-version: '7.3'
branch: '1.7.7.0'
composerv1: 1
- php-version: '7.1'
branch: '1.7.8.10'
coverage: 1
# - php-version: '7.1' - Error install PrestaShop
# branch: '1.7.8.10'
- php-version: '7.2'
branch: '1.7.8.10'
coverage: 1
- php-version: '7.3'
branch: '1.7.8.10'
services:

View File

@ -1,3 +1,6 @@
## v3.6.4
* Добавлена передача услуг через ICML каталог
## v3.6.3
* Исправление активации/деактивации модуля

View File

@ -1 +1 @@
3.6.3
3.6.4

View File

@ -207,6 +207,10 @@ class RetailcrmCatalog
$dimensions = null;
}
$useServices = RetailcrmTools::isIcmlServicesEnabled()
&& !empty($product['is_virtual'])
&& empty($product['uploadable_files']);
$offers = Product::getProductAttributesIds($product['id_product']);
$features = Product::getFrontFeaturesStatic($id_lang, $product['id_product']);
@ -276,6 +280,7 @@ class RetailcrmCatalog
$item = [
'id' => $product['id_product'] . '#' . $offer['id_product_attribute'],
'type' => $useServices ? 'service' : 'product',
'productId' => $product['id_product'],
'productActivity' => ($available_for_order) ? 'Y' : 'N',
'name' => ('' === $name) ? $productName : $name,
@ -334,6 +339,7 @@ class RetailcrmCatalog
'RetailcrmFilterProcessOffer',
[
'id' => $product['id_product'],
'type' => $useServices ? 'service' : 'product',
'productId' => $product['id_product'],
'productActivity' => ($available_for_order) ? 'Y' : 'N',
'name' => $productName,

View File

@ -181,6 +181,7 @@ class RetailcrmIcml
$this->writer->startElement('offer'); // start <offer>
$this->writer->writeAttribute('id', $offer['id']);
$this->writer->writeAttribute('type', $offer['type']);
$this->writer->writeAttribute('productId', $offer['productId']);
$this->writer->writeAttribute('quantity', (int) $offer['quantity']);

View File

@ -68,6 +68,16 @@ class RetailcrmTools
return (bool) Configuration::get(RetailCRM::ENABLE_CORPORATE_CLIENTS);
}
/**
* Returns true if ICML service transfer is enabled in the settings
*
* @return bool
*/
public static function isIcmlServicesEnabled()
{
return (bool) Configuration::get(RetailCRM::ENABLE_ICML_SERVICES);
}
/**
* Returns true if customer is corporate
*

View File

@ -58,6 +58,7 @@ class RetailcrmSettingsItems
'enableBalancesReceiving' => new RetailcrmSettingsItemBool('enableBalancesReceiving', RetailCRM::ENABLE_BALANCES_RECEIVING),
'collectorActive' => new RetailcrmSettingsItemBool('collectorActive', RetailCRM::COLLECTOR_ACTIVE),
'synchronizeCartsActive' => new RetailcrmSettingsItemBool('synchronizeCartsActive', RetailCRM::SYNC_CARTS_ACTIVE),
'enableIcmlServices' => new RetailcrmSettingsItemBool('enableIcmlServices', RetailCRM::ENABLE_ICML_SERVICES),
'enableCorporate' => new RetailcrmSettingsItemBool('enableCorporate', RetailCRM::ENABLE_CORPORATE_CLIENTS),
'enableOrderNumberSending' => new RetailcrmSettingsItemBool('enableOrderNumberSending', RetailCRM::ENABLE_ORDER_NUMBER_SENDING),
'enableOrderNumberReceiving' => new RetailcrmSettingsItemBool('enableOrderNumberReceiving', RetailCRM::ENABLE_ORDER_NUMBER_RECEIVING),

View File

@ -48,7 +48,7 @@ require_once dirname(__FILE__) . '/bootstrap.php';
class RetailCRM extends Module
{
const VERSION = '3.6.3';
const VERSION = '3.6.4';
const API_URL = 'RETAILCRM_ADDRESS';
const API_KEY = 'RETAILCRM_API_TOKEN';
@ -66,6 +66,7 @@ class RetailCRM extends Module
const SYNC_CARTS_DELAY = 'RETAILCRM_API_SYNCHRONIZED_CART_DELAY';
const UPLOAD_ORDERS = 'RETAILCRM_UPLOAD_ORDERS_ID';
const MODULE_LIST_CACHE_CHECKSUM = 'RETAILCRM_MODULE_LIST_CACHE_CHECKSUM';
const ENABLE_ICML_SERVICES = 'RETAILCRM_ENABLE_ICML_SERVICES';
const ENABLE_CORPORATE_CLIENTS = 'RETAILCRM_ENABLE_CORPORATE_CLIENTS';
const ENABLE_HISTORY_UPLOADS = 'RETAILCRM_ENABLE_HISTORY_UPLOADS';
const ENABLE_BALANCES_RECEIVING = 'RETAILCRM_ENABLE_BALANCES_RECEIVING';
@ -336,6 +337,7 @@ class RetailCRM extends Module
&& Configuration::deleteByName(static::SYNC_CARTS_DELAY)
&& Configuration::deleteByName(static::UPLOAD_ORDERS)
&& Configuration::deleteByName(static::MODULE_LIST_CACHE_CHECKSUM)
&& Configuration::deleteByName(static::ENABLE_ICML_SERVICES)
&& Configuration::deleteByName(static::ENABLE_CORPORATE_CLIENTS)
&& Configuration::deleteByName(static::ENABLE_HISTORY_UPLOADS)
&& Configuration::deleteByName(static::ENABLE_BALANCES_RECEIVING)

File diff suppressed because one or more lines are too long