Skip to content

Commit c34d42f

Browse files
authored
Merge branch '2.4-develop' into B2B-2257
2 parents e123f7e + 4aeb66b commit c34d42f

File tree

26 files changed

+593
-178
lines changed

26 files changed

+593
-178
lines changed

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,66 +20,72 @@ $viewModel = $block->getData('validateQuantityViewModel');
2020
</label>
2121
<div class="control">
2222
<div class="nested options-list">
23-
<?php if ($block->showSingle()) : ?>
23+
<?php if ($block->showSingle()): ?>
2424
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?>
2525
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?>
2626
<input type="hidden"
27-
class="bundle-option-<?= (int)$_option->getId() ?> product bundle option"
28-
name="bundle_option[<?= (int)$_option->getId() ?>]"
29-
value="<?= (int)$_selections[0]->getSelectionId() ?>"
30-
id="bundle-option-<?= (int)$_option->getId() ?>-<?= (int)$_selections[0]->getSelectionId() ?>"
31-
checked="checked"
27+
class="bundle-option-<?= (int)$_option->getId() ?> product bundle option"
28+
name="bundle_option[<?= (int)$_option->getId() ?>]"
29+
value="<?= (int)$_selections[0]->getSelectionId() ?>"
30+
id="bundle-option-<?= (int)$_option->getId() ?>-<?= (int)$_selections[0]->getSelectionId() ?>"
31+
checked="checked"
3232
/>
33-
<?php else :?>
34-
<?php if (!$_option->getRequired()) : ?>
33+
<?php else: ?>
34+
<?php if (!$_option->getRequired()): ?>
3535
<div class="field choice">
3636
<input type="radio"
3737
class="radio product bundle option"
3838
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
3939
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
4040
data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
41-
<?= ($_default && $_default->isSalable())?'':' checked="checked" ' ?>
41+
<?= ($_default && $_default->isSalable())?'':' checked="checked" ' ?>
4242
value=""/>
4343
<label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>">
4444
<span><?= $block->escapeHtml(__('None')) ?></span>
4545
</label>
4646
</div>
4747
<?php endif; ?>
48-
<?php foreach ($_selections as $_selection) : ?>
48+
<?php foreach ($_selections as $_selection): ?>
4949
<div class="field choice">
5050
<input type="radio"
5151
class="radio product bundle option change-container-classname"
52-
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
53-
<?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':true}"'; }?>
52+
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
53+
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
54+
<?php if ($_option->getRequired()) {
55+
echo 'data-validate="{\'validate-one-required-by-name\':true}"';
56+
} ?>
5457
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
5558
data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
56-
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
57-
<?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>
58-
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/>
59+
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
60+
<?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>
61+
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
62+
data-errors-message-box="#validation-message-box-radio"/>
5963
<label class="label"
60-
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
64+
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
65+
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
6166
<span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span>
6267
<br/>
6368
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?>
6469
</label>
6570
</div>
6671
<?php endforeach; ?>
6772
<div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div>
73+
<div id="validation-message-box-radio"></div>
6874
<?php endif; ?>
6975
<div class="field qty qty-holder">
7076
<label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
7177
<span><?= $block->escapeHtml(__('Quantity')) ?></span>
7278
</label>
7379
<div class="control">
7480
<input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
75-
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
76-
class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
77-
type="number"
78-
min="0"
79-
data-validate="<?= $block->escapeHtmlAttr($viewModel->getQuantityValidators()) ?>"
80-
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
81-
data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
82-
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/>
81+
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
82+
class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
83+
type="number"
84+
min="0"
85+
data-validate="<?= $block->escapeHtmlAttr($viewModel->getQuantityValidators()) ?>"
86+
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
87+
data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
88+
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/>
8389
</div>
8490
</div>
8591
</div>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111

1212
<section name="StoreFrontRecentlyViewedProductSection">
1313
<element name="ProductName" type="text" selector="//div[@class='products-grid']/ol/li[position()={{position}}]/div/div[@class='product-item-details']/strong/a" parameterized="true"/>
14+
<element name="ProductPrice" type="text" selector=".price-including-tax .price"/>
1415
</section>
15-
</sections>
16+
</sections>

app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Price.php

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
use Magento\Catalog\Api\Data\ProductRender\PriceInfoInterfaceFactory;
1212
use Magento\Catalog\Api\Data\ProductRenderInterface;
1313
use Magento\Catalog\Model\ProductRender\FormattedPriceInfoBuilder;
14+
use Magento\Catalog\Pricing\Price\FinalPrice;
15+
use Magento\Catalog\Pricing\Price\RegularPrice;
1416
use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorInterface;
1517
use Magento\Framework\Pricing\PriceCurrencyInterface;
18+
use Magento\GroupedProduct\Model\Product\Type\Grouped;
1619

1720
/**
1821
* Collect information about base prices of products
@@ -22,18 +25,6 @@
2225
*/
2326
class Price implements ProductRenderCollectorInterface
2427
{
25-
/** FInal Price key */
26-
const KEY_FINAL_PRICE = "final_price";
27-
28-
/** Minimal Price key */
29-
const KEY_MINIMAL_PRICE = "minimal_price";
30-
31-
/** Regular Price key */
32-
const KEY_REGULAR_PRICE = "regular_price";
33-
34-
/** Max Price key */
35-
const KEY_MAX_PRICE = "max_price";
36-
3728
/**
3829
* @var PriceCurrencyInterface
3930
*/
@@ -84,40 +75,49 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ
8475
$priceInfo = $this->priceInfoFactory->create();
8576
}
8677

87-
$priceInfo->setFinalPrice(
88-
$product
89-
->getPriceInfo()
90-
->getPrice('final_price')
91-
->getAmount()
92-
->getValue()
93-
);
94-
$priceInfo->setMinimalPrice(
95-
$product
78+
if ($product->getTypeId() === Grouped::TYPE_CODE) {
79+
$product = $product
9680
->getPriceInfo()
97-
->getPrice('final_price')
98-
->getMinimalPrice()
99-
->getValue()
100-
);
101-
$priceInfo->setRegularPrice(
102-
$product
103-
->getPriceInfo()
104-
->getPrice('regular_price')
105-
->getAmount()
106-
->getValue()
107-
);
108-
$priceInfo->setMaxPrice(
109-
$product
110-
->getPriceInfo()
111-
->getPrice('final_price')
112-
->getMaximalPrice()
113-
->getValue()
114-
);
81+
->getPrice(FinalPrice::PRICE_CODE)
82+
->getMinProduct();
83+
}
11584

116-
$this->formattedPriceInfoBuilder->build(
117-
$priceInfo,
118-
$productRender->getStoreId(),
119-
$productRender->getCurrencyCode()
120-
);
85+
if ($product !== null) {
86+
$priceInfo->setFinalPrice(
87+
$product
88+
->getPriceInfo()
89+
->getPrice(FinalPrice::PRICE_CODE)
90+
->getAmount()
91+
->getValue()
92+
);
93+
$priceInfo->setMinimalPrice(
94+
$product
95+
->getPriceInfo()
96+
->getPrice(FinalPrice::PRICE_CODE)
97+
->getMinimalPrice()
98+
->getValue()
99+
);
100+
$priceInfo->setRegularPrice(
101+
$product
102+
->getPriceInfo()
103+
->getPrice(RegularPrice::PRICE_CODE)
104+
->getAmount()
105+
->getValue()
106+
);
107+
$priceInfo->setMaxPrice(
108+
$product
109+
->getPriceInfo()
110+
->getPrice(FinalPrice::PRICE_CODE)
111+
->getMaximalPrice()
112+
->getValue()
113+
);
114+
115+
$this->formattedPriceInfoBuilder->build(
116+
$priceInfo,
117+
$productRender->getStoreId(),
118+
$productRender->getCurrencyCode()
119+
);
120+
}
121121

122122
$productRender->setPriceInfo($priceInfo);
123123
}

app/code/Magento/Catalog/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"magento/module-ui": "*",
3232
"magento/module-url-rewrite": "*",
3333
"magento/module-widget": "*",
34-
"magento/module-wishlist": "*"
34+
"magento/module-wishlist": "*",
35+
"magento/module-grouped-product": "*"
3536
},
3637
"suggest": {
3738
"magento/module-cookie": "*",

app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,47 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/** @var $block \Magento\Catalog\Block\Product\View */
7+
use Magento\Catalog\Block\Product\View;
8+
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Pricing\Price\FinalPrice;
10+
use Magento\Framework\Escaper;
11+
use Magento\GroupedProduct\Model\Product\Type\Grouped;
12+
13+
/**
14+
* @var View $block
15+
* @var Escaper $escaper
16+
*/
817
?>
918

1019
<meta property="og:type" content="product" />
1120
<meta property="og:title"
12-
content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" />
21+
content="<?= $escaper->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" />
1322
<meta property="og:image"
14-
content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
23+
content="<?= $escaper->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>"
24+
/>
1525
<meta property="og:description"
16-
content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
26+
content="<?= $escaper->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
1727
<meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" />
18-
<?php if ($priceAmount = $block->getProduct()
19-
->getPriceInfo()
20-
->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)
21-
->getAmount()):?>
22-
<meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/>
23-
<?= $block->getChildHtml('meta.currency') ?>
28+
<?php
29+
if ($block->getProduct()->getTypeId() === Grouped::TYPE_CODE):
30+
/** @var Product $minProduct */
31+
$minProduct = $block->getProduct()
32+
->getPriceInfo()
33+
->getPrice(FinalPrice::PRICE_CODE)
34+
->getMinProduct();
35+
36+
$priceAmount = ($minProduct !== null) ? $minProduct->getPriceInfo()
37+
->getPrice(FinalPrice::PRICE_CODE)
38+
->getAmount() : $minProduct;
39+
else:
40+
$priceAmount = $block->getProduct()
41+
->getPriceInfo()
42+
->getPrice(FinalPrice::PRICE_CODE)
43+
->getAmount();
44+
endif;
45+
?>
46+
47+
<?php if ($priceAmount !== null): ?>
48+
<meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/>
49+
<?= $block->getChildHtml('meta.currency') ?>
2450
<?php endif;?>

app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getRowClickCallback()
100100
$js = '
101101
function (grid, event) {
102102
var trElement = Event.findElement(event, "tr");
103-
var blockId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,"");
103+
var blockId = trElement.down("td").next().next().innerHTML.replace(/^\s+|\s+$/g,"");
104104
var blockTitle = trElement.down("td").next().innerHTML;
105105
' .
106106
$chooserJsObject .
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAssertCMSPageContentParamValueActionGroup">
11+
<annotations>
12+
<description>Assert content param with value on CMS page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="param" type="string"/>
16+
<argument name="value" type="string"/>
17+
</arguments>
18+
19+
<grabValueFrom selector="{{CmsNewPagePageActionsSection.content}}" stepKey="grabContent"/>
20+
<assertStringContainsString stepKey="assertClass">
21+
<actualResult type="string">{$grabContent}</actualResult>
22+
<expectedResult type="string">{{param}}=&quot;{{value}}&quot;</expectedResult>
23+
</assertStringContainsString>
24+
</actionGroup>
25+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminClickSelectBlockActionGroup">
11+
<annotations>
12+
<description>Click on Select Block button.</description>
13+
</annotations>
14+
15+
<waitForElementVisible selector="{{WidgetSection.BtnChooser}}" stepKey="waitForSelectBlockButtonVisible"/>
16+
<click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectBlockBtn"/>
17+
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminSelectBlockOnGridActionGroup">
11+
<annotations>
12+
<description>Selects block on grid and click insert widget button.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="block"/>
16+
</arguments>
17+
18+
<click selector="{{WidgetSection.BlockPage(block.identifier)}}" stepKey="selectPreCreateBlock" />
19+
<waitForElementVisible selector="{{WidgetSection.InsertWidget}}" stepKey="waitForInsertWidgetBtn"/>
20+
<click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidgetBtn" />
21+
</actionGroup>
22+
</actionGroups>

0 commit comments

Comments
 (0)