Minor improvements

* Fix country iso code
* Fix ICML weight generation
* Update phpcs rules to php >= 7.3
This commit is contained in:
Vlad 2022-04-01 13:14:34 +03:00 committed by GitHub
parent 463485509e
commit 6790cf7b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View File

@ -46,4 +46,4 @@ phpcs-config:
bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility
phpcomp: phpcs-config phpcomp: phpcs-config
@bin/phpcs -s -p ./src --standard=PHPCompatibility --runtime-set testVersion 5.4-7.3 @bin/phpcs -s -p ./src --standard=PHPCompatibility --runtime-set testVersion 7.3-7.4

View File

@ -312,7 +312,11 @@ class ModelExtensionRetailcrmIcml extends Model
$weight = $this->dd->createElement('param'); $weight = $this->dd->createElement('param');
$weight->setAttribute('code', 'weight'); $weight->setAttribute('code', 'weight');
$weight->setAttribute('name', $this->language->get('weight')); $weight->setAttribute('name', $this->language->get('weight'));
$weightValue = round($product['weight'] + $optionsValues['weight'], 3); if (!empty($optionsValues['weight'])) {
$weightValue = round($product['weight'] + $optionsValues['weight'], 3);
} else {
$weightValue = round($product['weight'], 3);
}
if (isset($product['weight_class'])) { if (isset($product['weight_class'])) {
$weightValue = $weightValue . ' ' . $product['weight_class']; $weightValue = $weightValue . ' ' . $product['weight_class'];

View File

@ -77,8 +77,8 @@ class ControllerApiRetailcrm extends Controller
$address = array( $address = array(
'country_id' => $country_id, 'country_id' => $country_id,
'zone_id' => $zone['zone_id'], 'zone_id' => $zone['zone_id'],
'iso_code_2' => $country['iso_code_2'], 'iso_code_2' => $country['iso_code_2'] ?? '',
'iso_code_3' => $country['iso_code_3'], 'iso_code_3' => $country['iso_code_3'] ?? '',
'zone_code' => $zone['code'], 'zone_code' => $zone['code'],
'postcode' => '', 'postcode' => '',
'city' => '' 'city' => ''

View File

@ -31,7 +31,7 @@ class OpencartApiClient {
$cookies = array(); $cookies = array();
foreach ($cookieFile as $line) { foreach ($cookieFile as $line) {
if (empty($line) OR $line{0} == '#') { if (empty($line) OR $line[0] == '#') {
continue; continue;
} }