Skip to content

Commit

Permalink
ref #73045 Fixed the transfer of the weight of offers
Browse files Browse the repository at this point in the history
  • Loading branch information
uryvskiy-dima authored Jul 4, 2023
2 parents 6a7f395 + a2a4eca commit 22a9c2d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v4.1.11
* Fixed the transfer of the weight offers

## v4.1.10
* Types of deliveries and payments are displayed only active status and available stores

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.10
4.1.11
27 changes: 17 additions & 10 deletions src/upload/admin/model/extension/retailcrm/icml.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct($registry)
{
parent::__construct($registry);
$this->load->library('retailcrm/retailcrm');
$this->load->model('localisation/weight_class');
}

public function generateICML()
Expand Down Expand Up @@ -107,6 +108,12 @@ private function addOffers() {
$defaultCurrency = $this->getDefaultCurrency();
$settingLenght = $this->retailcrm->getLenghtForIcml();
$leghtsArray = $this->model_localisation_length_class->getLengthClasses();
$weightClassesMas = $this->model_localisation_weight_class->getWeightClasses();
$weightClasses = [];

foreach ($weightClassesMas as $weightClass) {
$weightClasses[$weightClass['weight_class_id']]['value'] = $weightClass['value'];
}

foreach ($leghtsArray as $lenght) {
if ($lenght['value'] == 1) {
Expand Down Expand Up @@ -309,19 +316,19 @@ private function addOffers() {
$e->appendChild($sku);
}
if ($product['weight'] != '') {
$weight = $this->dd->createElement('param');
$weight->setAttribute('code', 'weight');
$weight->setAttribute('name', $this->language->get('weight'));
if (!empty($optionsValues['weight'])) {
$weightValue = round($product['weight'] + $optionsValues['weight'], 3);
} else {
$weightValue = round($product['weight'], 3);
}
$weight = $this->dd->createElement('weight');
$coeffWeight = 1;

if (isset($product['weight_class'])) {
$weightValue = $weightValue . ' ' . $product['weight_class'];
if (!empty($weightClasses[$product['weight_class_id']]['value'])) {
$coeffWeight = $weightClasses[$product['weight_class_id']]['value'];
}

$weightValue = !empty($optionsValues['weight'])
? $product['weight'] + $optionsValues['weight']
: $product['weight']
;
$weightValue = round($weightValue / $coeffWeight, 6);

$weight->appendChild($this->dd->createTextNode($weightValue));
$e->appendChild($weight);
}
Expand Down

0 comments on commit 22a9c2d

Please sign in to comment.