Skip to content

Commit 621c283

Browse files
author
Dmytro Vilchynskyi
committed
MAGETWO-71515: Special/lowest price in child of a Configurable Product causes the entire product to show that price
- FAT
1 parent d7d353f commit 621c283

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/ListCompare.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ class ListCompare extends Block
9494
protected $messageBlock = '#messages';
9595

9696
/**
97-
* Get product info.
97+
* Get Product info.
9898
*
9999
* @param int $index
100100
* @param string $attributeKey
101101
* @param string $currency
102-
* @return string
102+
* @return string|array
103103
*/
104104
public function getProductInfo($index, $attributeKey, $currency = ' $')
105105
{
@@ -108,7 +108,11 @@ public function getProductInfo($index, $attributeKey, $currency = ' $')
108108
$price = $infoBlock->find($this->priceSelector, Locator::SELECTOR_XPATH)->getText();
109109
preg_match_all('`([a-z]+).*?([\d\.]+)`i', $price, $prices);
110110
if (!empty($prices[0])) {
111-
return number_format(end($prices)[0], $this->priceFormat);
111+
$resultPrice = [];
112+
foreach ($prices[1] as $key => $value) {
113+
$resultPrice['price_' . lcfirst($value)] = $prices[2][$key];
114+
}
115+
return $resultPrice;
112116
}
113117
return trim($price, $currency);
114118
} else {

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
<constraint name="Magento\Catalog\Test\Constraint\AssertProductComparePage" />
2424
</variation>
2525
<variation name="AddCompareProductsTestVariation3">
26-
<data name="products" xsi:type="string">configurableProduct::configurable_with_qty_1</data>
26+
<data name="products" xsi:type="string">configurableProduct::configurable_as_low_as</data>
2727
<data name="isCustomerLoggedIn" xsi:type="string">Yes</data>
2828
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
2929
<constraint name="Magento\Catalog\Test\Constraint\AssertProductComparePage" />
3030
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareBlockOnCmsPage" />
3131
</variation>
3232
<variation name="AddCompareProductsTestVariation4">
3333
<data name="tag" xsi:type="string">stable:no</data>
34-
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::configurable_with_qty_1,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
34+
<data name="products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::configurable_as_low_as,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product</data>
3535
<data name="isCustomerLoggedIn" xsi:type="string">Yes</data>
3636
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCompareItemsLink" />
3737
<constraint name="Magento\Catalog\Test\Constraint\AssertProductComparePage" />

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,37 @@
7272
</field>
7373
</dataset>
7474

75+
<dataset name="configurable_as_low_as">
76+
<field name="name" xsi:type="string">Test configurable product %isolation%</field>
77+
<field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field>
78+
<field name="price" xsi:type="array">
79+
<item name="dataset" xsi:type="string">price_as-40.00</item>
80+
</field>
81+
<field name="product_has_weight" xsi:type="string">This item has weight</field>
82+
<field name="weight" xsi:type="string">30</field>
83+
<field name="status" xsi:type="string">Yes</field>
84+
<field name="visibility" xsi:type="string">Catalog, Search</field>
85+
<field name="tax_class_id" xsi:type="array">
86+
<item name="dataset" xsi:type="string">taxable_goods</item>
87+
</field>
88+
<field name="url_key" xsi:type="string">configurable-product-%isolation%</field>
89+
<field name="configurable_attributes_data" xsi:type="array">
90+
<item name="dataset" xsi:type="string">default</item>
91+
</field>
92+
<field name="quantity_and_stock_status" xsi:type="array">
93+
<item name="is_in_stock" xsi:type="string">In Stock</item>
94+
</field>
95+
<field name="website_ids" xsi:type="array">
96+
<item name="0" xsi:type="string">Main Website</item>
97+
</field>
98+
<field name="attribute_set_id" xsi:type="array">
99+
<item name="dataset" xsi:type="string">default</item>
100+
</field>
101+
<field name="checkout_data" xsi:type="array">
102+
<item name="dataset" xsi:type="string">configurable_options_with_qty_1</item>
103+
</field>
104+
</dataset>
105+
75106
<dataset name="product_with_special_price">
76107
<field name="name" xsi:type="string">Test configurable product %isolation%</field>
77108
<field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field>

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/Price.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<dataset name="default">
1111
<field name="category_price" xsi:type="string">1</field>
1212
</dataset>
13+
<dataset name="price_as-40.00">
14+
<field name="compare_price" xsi:type="array">
15+
<item name="price_as" xsi:type="string">40.00</item>
16+
</field>
17+
</dataset>
1318
<dataset name="price_40">
1419
<field name="category_price" xsi:type="string">40</field>
1520
<field name="compare_price" xsi:type="string">40.00</field>

0 commit comments

Comments
 (0)