Skip to content

Commit 3489e1b

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #17982: add error message in else condition (by @vaibhavahalpara) - #17695: ConfigurableProduct show prices in select options (by @alexeya-ven) - #18354: Fix for parsing attribute options labels, when & used. (by @bartoszkubicki) Fixed GitHub Issues: - #17977: Show Method if Not Applicable for Free Shipping doesn't work. (reported by @vaibhavahalpara) has been fixed in #17982 by @vaibhavahalpara in 2.2-develop branch Related commits: 1. 3d13f78 2. 7107b8d 3. 49f6549
2 parents 41aeb20 + 8ae91cf commit 3489e1b

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ private function preprocessOptionsData(&$data)
327327
$serializedOptions = json_decode($data['serialized_options'], JSON_OBJECT_AS_ARRAY);
328328
foreach ($serializedOptions as $serializedOption) {
329329
$option = [];
330-
parse_str($serializedOption, $option);
330+
$serializedOptionWithParsedAmpersand = str_replace('&', '%26', $serializedOption);
331+
parse_str($serializedOptionWithParsedAmpersand, $option);
331332
$data = array_replace_recursive($data, $option);
332333
}
333334
}

app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,11 @@ define([
360360
index = 1,
361361
allowedProducts,
362362
i,
363-
j;
363+
j,
364+
basePrice = parseFloat(this.options.spConfig.prices.basePrice.amount),
365+
optionFinalPrice,
366+
optionPriceDiff,
367+
optionPrices = this.options.spConfig.optionPrices;
364368

365369
this._clearSelect(element);
366370
element.options[0] = new Option('', '');
@@ -374,6 +378,7 @@ define([
374378
if (options) {
375379
for (i = 0; i < options.length; i++) {
376380
allowedProducts = [];
381+
optionPriceDiff = 0;
377382

378383
/* eslint-disable max-depth */
379384
if (prevConfig) {
@@ -387,14 +392,28 @@ define([
387392
}
388393
} else {
389394
allowedProducts = options[i].products.slice(0);
395+
396+
if (typeof allowedProducts[0] !== 'undefined' &&
397+
typeof optionPrices[allowedProducts[0]] !== 'undefined') {
398+
399+
optionFinalPrice = parseFloat(optionPrices[allowedProducts[0]].finalPrice.amount);
400+
optionPriceDiff = optionFinalPrice - basePrice;
401+
402+
if (optionPriceDiff !== 0) {
403+
options[i].label = options[i].label + ' ' + priceUtils.formatPrice(
404+
optionPriceDiff,
405+
this.options.priceFormat,
406+
true);
407+
}
408+
}
390409
}
391410

392411
if (allowedProducts.length > 0) {
393412
options[i].allowedProducts = allowedProducts;
394413
element.options[index] = new Option(this._getOptionLabel(options[i]), options[i].id);
395414

396415
if (typeof options[i].price !== 'undefined') {
397-
element.options[index].setAttribute('price', options[i].prices);
416+
element.options[index].setAttribute('price', options[i].price);
398417
}
399418

400419
element.options[index].config = options[i];

app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,18 @@ public function collectRates(RateRequest $request)
9797
$method->setCost('0.00');
9898

9999
$result->append($method);
100+
} elseif ($this->getConfigData('showmethod')) {
101+
$error = $this->_rateErrorFactory->create();
102+
$error->setCarrier($this->_code);
103+
$error->setCarrierTitle($this->getConfigData('title'));
104+
$errorMsg = $this->getConfigData('specificerrmsg');
105+
$error->setErrorMessage(
106+
$errorMsg ? $errorMsg : __(
107+
'Sorry, but we can\'t deliver to the destination country with this shipping module.'
108+
)
109+
);
110+
return $error;
100111
}
101-
102112
return $result;
103113
}
104114

0 commit comments

Comments
 (0)