Skip to content

Commit ff137a0

Browse files
Merge branch 'MC-10973' of https://github.com/magento-epam/magento2ce into MC-10973
2 parents 8dfe26a + 56681f0 commit ff137a0

File tree

17 files changed

+431
-54
lines changed

17 files changed

+431
-54
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@
146146
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
147147
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
148148
</entity>
149+
<entity name="ApiSimpleProductWithPrice50" type="product2" extends="ApiSimpleOne">
150+
<data key="price">50</data>
151+
</entity>
152+
<entity name="ApiSimpleProductWithPrice60" type="product2" extends="ApiSimpleTwo">
153+
<data key="price">60</data>
154+
</entity>
155+
<entity name="ApiSimpleProductWithPrice70" type="product2" extends="SimpleOne">
156+
<data key="price">70</data>
157+
</entity>
149158
<entity name="ApiSimpleTwoHidden" type="product2">
150159
<data key="sku" unique="suffix">api-simple-product-two</data>
151160
<data key="type_id">simple</data>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<element name="productTierPricePercentageValuePriceInput" type="input" selector="[name='product[tier_price][{{var1}}][percentage_value]']" parameterized="true"/>
2121
<element name="specialPrice" type="input" selector="input[name='product[special_price]']"/>
2222
<element name="doneButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-primary" timeout="5"/>
23+
<element name="msrp" type="input" selector="//input[@name='product[msrp]']" timeout="30"/>
2324
<element name="save" type="button" selector="#save-button"/>
2425
</section>
2526
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
<element name="productOptionFile" type="file" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'OptionFile')]/../div[@class='control']//input[@type='file']" parameterized="true"/>
3030
<element name="productOptionSelect" type="select" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//select" parameterized="true"/>
3131
<element name="specialPriceValue" type="text" selector="//span[@class='special-price']//span[@class='price']"/>
32-
32+
<element name="mapPrice" type="text" selector="//div[@class='price-box price-final_price']//span[contains(@class, 'price-msrp_price')]"/>
33+
<element name="clickForPriceLink" type="text" selector="//div[@class='price-box price-final_price']//a[contains(text(), 'Click for price')]"/>
3334

3435
<!-- The parameter is the nth custom option that you want to get -->
3536
<element name="nthCustomOption" type="block" selector="//*[@id='product-options-wrapper']/*[@class='fieldset']/*[contains(@class, 'field')][{{customOptionNum}}]" parameterized="true" />

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Magento\Framework\Pricing\PriceCurrencyInterface;
1616

1717
/**
18+
* Confugurable product view type
19+
*
1820
* @api
1921
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2022
* @api
@@ -276,6 +278,8 @@ protected function getOptionImages()
276278
}
277279

278280
/**
281+
* Collect price options
282+
*
279283
* @return array
280284
*/
281285
protected function getOptionPrices()
@@ -314,6 +318,11 @@ protected function getOptionPrices()
314318
),
315319
],
316320
'tierPrices' => $tierPrices,
321+
'msrpPrice' => [
322+
'amount' => $this->localeFormat->getNumber(
323+
$product->getMsrp()
324+
),
325+
],
317326
];
318327
}
319328
return $prices;

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ function ($item) {
13851385
*/
13861386
private function getUsedProductsCacheKey($keyParts)
13871387
{
1388-
return md5(implode('_', $keyParts));
1388+
return sha1(implode('_', $keyParts));
13891389
}
13901390

13911391
/**
@@ -1445,4 +1445,22 @@ function($attr) {
14451445

14461446
return array_unique(array_merge($productAttributes, $requiredAttributes, $usedAttributes));
14471447
}
1448+
1449+
/**
1450+
* Returns msrp for children products
1451+
*
1452+
* @param \Magento\Catalog\Model\Product $product
1453+
* @return int
1454+
*/
1455+
public function getChildrenMsrp(\Magento\Catalog\Model\Product $product)
1456+
{
1457+
$prices = [];
1458+
foreach ($this->getUsedProducts($product) as $item) {
1459+
if ($item->getMsrp() !== null) {
1460+
$prices[] = $item->getMsrp();
1461+
}
1462+
}
1463+
return $prices ? max($prices) : 0;
1464+
}
1465+
14481466
}

app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ private function getExpectedArray($productId, $amount, $priceQty, $percentage):
379379
'percentage' => $percentage,
380380
],
381381
],
382+
'msrpPrice' => [
383+
'amount' => null ,
384+
]
382385
],
383386
],
384387
'priceFormat' => [],

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,13 @@ define([
609609
} else {
610610
$(this.options.slyOldPriceSelector).hide();
611611
}
612+
613+
$(document).trigger('updateMsrpPriceBlock',
614+
[
615+
optionId,
616+
this.options.spConfig.optionPrices
617+
]
618+
);
612619
},
613620

614621
/**

app/code/Magento/Msrp/Helper/Data.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ public function __construct(
7070
}
7171

7272
/**
73-
* Check if can apply Minimum Advertise price to product
74-
* in specific visibility
73+
* Check if can apply Minimum Advertise price to product in specific visibility
7574
*
7675
* @param int|Product $product
7776
* @param int|null $visibility Check displaying price in concrete place (by default generally)
@@ -135,6 +134,8 @@ public function isShowPriceOnGesture($product)
135134
}
136135

137136
/**
137+
* Check if we should show MAP proce before order confirmation
138+
*
138139
* @param int|Product $product
139140
* @return bool
140141
*/
@@ -144,6 +145,8 @@ public function isShowBeforeOrderConfirm($product)
144145
}
145146

146147
/**
148+
* Check if any MAP price is larger than as low as value.
149+
*
147150
* @param int|Product $product
148151
* @return bool|float
149152
*/
@@ -155,7 +158,8 @@ public function isMinimalPriceLessMsrp($product)
155158
$msrp = $product->getMsrp();
156159
$price = $product->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE);
157160
if ($msrp === null) {
158-
if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) {
161+
if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE
162+
&& $product->getTypeId() !== \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {
159163
return false;
160164
} else {
161165
$msrp = $product->getTypeInstance()->getChildrenMsrp($product);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="MsrpEnableMAP" type="msrp_settings_config">
12+
<requiredEntity type="enabled">EnableMAP</requiredEntity>
13+
</entity>
14+
<entity name="EnableMAP" type="msrp_settings_config">
15+
<data key="value">1</data>
16+
</entity>
17+
18+
<entity name="MsrpDisableMAP" type="msrp_settings_config">
19+
<requiredEntity type="enabled">DisableMAP</requiredEntity>
20+
</entity>
21+
<entity name="DisableMAP" type="msrp_settings_config">
22+
<data key="value">0</data>
23+
</entity>
24+
</entities>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
10+
<operation name="MsrpSettingsConfig" dataType="msrp_settings_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/sales/" method="POST">
11+
<object key="groups" dataType="msrp_settings_config">
12+
<object key="msrp" dataType="msrp_settings_config">
13+
<object key="fields" dataType="msrp_settings_config">
14+
<object key="enabled" dataType="enabled">
15+
<field key="value">string</field>
16+
</object>
17+
</object>
18+
</object>
19+
</object>
20+
</operation>
21+
</operations>

0 commit comments

Comments
 (0)