Skip to content

Commit 406b1f4

Browse files
Merge branch '2.4-develop' into bugfix/issue-12225
# Conflicts: # app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php
2 parents e4be19b + 4ae0f74 commit 406b1f4

File tree

235 files changed

+10178
-849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+10178
-849
lines changed

app/code/Magento/Bundle/Model/Product/LinksList.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function __construct(
3939
}
4040

4141
/**
42+
* Bundle Product Items Data
43+
*
4244
* @param \Magento\Catalog\Api\Data\ProductInterface $product
4345
* @param int $optionId
4446
* @return \Magento\Bundle\Api\Data\LinkInterface[]
@@ -50,8 +52,12 @@ public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product, $o
5052
$productLinks = [];
5153
/** @var \Magento\Catalog\Model\Product $selection */
5254
foreach ($selectionCollection as $selection) {
55+
$bundledProductPrice = $selection->getSelectionPriceValue();
56+
if ($bundledProductPrice <= 0) {
57+
$bundledProductPrice = $selection->getPrice();
58+
}
5359
$selectionPriceType = $product->getPriceType() ? $selection->getSelectionPriceType() : null;
54-
$selectionPrice = $product->getPriceType() ? $selection->getSelectionPriceValue() : null;
60+
$selectionPrice = $bundledProductPrice ? $bundledProductPrice : null;
5561

5662
/** @var \Magento\Bundle\Api\Data\LinkInterface $productLink */
5763
$productLink = $this->linkFactory->create();
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest">
10+
<annotations>
11+
<features value="Bundle"/>
12+
<stories value="Bundle product details page"/>
13+
<title value="Customer should be able to see all the bundle items in invoice view"/>
14+
<description value="Customer should be able to see all the bundle items in invoice view"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MC-37515"/>
17+
<group value="Bundle"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
21+
<createData entity="SimpleProduct2" stepKey="firstSimpleProduct"/>
22+
<createData entity="SimpleProduct2" stepKey="secondSimpleProduct"/>
23+
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
24+
<actionGroup stepKey="loginToAdminPanel" ref="AdminLoginActionGroup"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
28+
<deleteData createDataKey="firstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
29+
<deleteData createDataKey="secondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
30+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
31+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
32+
</after>
33+
<!-- Create new bundle product -->
34+
<actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createBundleProduct">
35+
<argument name="productType" value="bundle"/>
36+
</actionGroup>
37+
38+
<!-- Fill all main fields -->
39+
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainProductFields"/>
40+
41+
<!-- Add first bundle option to the product -->
42+
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addFirstBundleOption">
43+
<argument name="x" value="0"/>
44+
<argument name="n" value="1"/>
45+
<argument name="prodOneSku" value="$firstSimpleProduct.sku$"/>
46+
<argument name="prodTwoSku" value="$secondSimpleProduct.sku$$"/>
47+
<argument name="optionTitle" value="{{CheckboxOption.title}}"/>
48+
<argument name="inputType" value="{{CheckboxOption.type}}"/>
49+
</actionGroup>
50+
51+
<!-- Save product form -->
52+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveWithThreeOptions"/>
53+
54+
<!--Login customer on storefront-->
55+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
56+
<argument name="Customer" value="$$createCustomer$$" />
57+
</actionGroup>
58+
59+
<!--Open Product Page-->
60+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
61+
<argument name="productUrl" value="{{BundleProduct.name}}"/>
62+
</actionGroup>
63+
64+
<!-- Add bundle to cart -->
65+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickAddToCart">
66+
<argument name="productUrl" value="{{BundleProduct.name}}"/>
67+
</actionGroup>
68+
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '1')}}" stepKey="selectOption2Product1"/>
69+
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '2')}}" stepKey="selectOption2Product2"/>
70+
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
71+
<argument name="quantity" value="1"/>
72+
</actionGroup>
73+
74+
<!--Navigate to checkout-->
75+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
76+
<!-- Click next button to open payment section -->
77+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
78+
<!-- Click place order -->
79+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
80+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
81+
82+
<!-- Order review page has address that was created during checkout -->
83+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById">
84+
<argument name="orderId" value="{$grabOrderNumber}"/>
85+
</actionGroup>
86+
87+
<!-- Open create invoice page -->
88+
<actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/>
89+
90+
<!-- Assert item options display -->
91+
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $firstSimpleProduct.sku$" stepKey="seeFirstProductInList"/>
92+
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $secondSimpleProduct.sku$" stepKey="seeSecondProductInList"/>
93+
</test>
94+
</tests>

app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testLinksList()
9191
->method('getSelectionsCollection')
9292
->with([$optionId], $this->productMock)
9393
->willReturn([$this->selectionMock]);
94-
$this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
94+
$this->productMock->expects($this->once())->method('getPriceType')->willReturn('price_type');
9595
$this->selectionMock->expects($this->once())
9696
->method('getSelectionPriceType')
9797
->willReturn('selection_price_type');

app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<?php $items = $block->getChildren($_item); ?>
1616
<?php $_count = count($items) ?>
1717
<?php $_index = 0 ?>
18+
<?php $canEditItemQty = true ?>
1819
<?php
1920
/** @var \Magento\Catalog\Helper\Data $catalogHelper */
2021
$catalogHelper = $block->getData('catalogHelper');
@@ -37,7 +38,7 @@ $catalogHelper = $block->getData('catalogHelper');
3738
<?php if ($_item->getOrderItem()->getParentItem()): ?>
3839
<?php
3940
if ($shipTogether) {
40-
continue;
41+
$canEditItemQty = false;
4142
}
4243
?>
4344
<?php $attributes = $block->getSelectionAttributes($_item) ?>
@@ -130,7 +131,7 @@ $catalogHelper = $block->getData('catalogHelper');
130131
</td>
131132
<td class="col-qty-invoice">
132133
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
133-
<?php if ($block->canEditQty()): ?>
134+
<?php if ($block->canEditQty() && $canEditItemQty): ?>
134135
<input type="text"
135136
class="input-text admin__control-text qty-input"
136137
name="invoice[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>]"

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ public function getJsonConfig()
196196
'productId' => (int)$product->getId(),
197197
'priceFormat' => $this->_localeFormat->getPriceFormat(),
198198
'prices' => [
199+
'baseOldPrice' => [
200+
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount() * 1,
201+
'adjustments' => []
202+
],
199203
'oldPrice' => [
200204
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1,
201205
'adjustments' => []

app/code/Magento/Catalog/Helper/Image.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ public function backgroundColor($colorRGB)
384384
{
385385
// assume that 3 params were given instead of array
386386
if (!is_array($colorRGB)) {
387+
//phpcs:disable
387388
$colorRGB = func_get_args();
389+
//phpcs:enabled
388390
}
389391
$this->_getModel()->setBackgroundColor($colorRGB);
390392
return $this;
@@ -498,7 +500,11 @@ protected function initBaseFile()
498500
if ($this->getImageFile()) {
499501
$model->setBaseFile($this->getImageFile());
500502
} else {
501-
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
503+
$model->setBaseFile(
504+
$this->getProduct()
505+
? $this->getProduct()->getData($model->getDestinationSubdir())
506+
: ''
507+
);
502508
}
503509
}
504510
return $this;

app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
</annotations>
2121

2222
<before>
23-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2423
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
26+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
27+
<!-- Should wait a bit for filters really cleared because waitForPageLoad does not wait for javascripts to be finished -->
28+
<!-- Without this test will fail sometimes -->
29+
<wait time="5" stepKey="waitFilterReallyCleared"/>
30+
<reloadPage stepKey="reloadPage"/>
2531
</before>
2632

2733
<after>

app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,14 @@ public function testGetWidth()
396396
$this->assertEquals($data['width'], $this->helper->getWidth());
397397
}
398398

399+
/**
400+
* Check initBaseFile without properties - product
401+
*/
402+
public function testGetUrlWithOutProduct()
403+
{
404+
$this->assertNull($this->helper->getUrl());
405+
}
406+
399407
/**
400408
* @param array $data
401409
* @dataProvider getHeightDataProvider

app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(
7171
public function getCategoryUrlSuffix()
7272
{
7373
return $this->scopeConfig->getValue(
74-
static::XML_PATH_CATEGORY_URL_SUFFIX,
74+
self::XML_PATH_CATEGORY_URL_SUFFIX,
7575
ScopeInterface::SCOPE_STORE
7676
);
7777
}
@@ -84,7 +84,7 @@ public function getCategoryUrlSuffix()
8484
public function isCategoryUsedInProductUrl(): bool
8585
{
8686
return $this->scopeConfig->isSetFlag(
87-
static::XML_PATH_PRODUCT_USE_CATEGORIES,
87+
self::XML_PATH_PRODUCT_USE_CATEGORIES,
8888
ScopeInterface::SCOPE_STORE
8989
);
9090
}

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ $_helper = $block->getData('outputHelper');
9898
<?= $block->getBlockHtml('formkey') ?>
9999
<button type="submit"
100100
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
101-
class="action tocart primary">
101+
class="action tocart primary"
102+
disabled>
102103
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
103104
</button>
104105
</form>

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37+
$(this.options.addToCartButtonSelector).attr('disabled', false);
3738
},
3839

3940
/**
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminFillCatalogProductsListWidgetTitleActionGroup">
12+
<annotations>
13+
<description>Fill catalog products list title field.</description>
14+
</annotations>
15+
16+
<arguments>
17+
<argument name="title" type="string" defaultValue=""/>
18+
</arguments>
19+
<waitForElementVisible selector="{{InsertWidgetSection.title}}" stepKey="waitForField"/>
20+
<fillField selector="{{InsertWidgetSection.title}}" userInput="{{title}}" stepKey="fillTitleField"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertWidgetTitleActionGroup">
12+
<annotations>
13+
<description>Assert widget title on storefront.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="title" type="string"/>
17+
</arguments>
18+
19+
<grabTextFrom selector="{{StorefrontWidgetsSection.widgetProductsGrid}} {{StorefrontWidgetsSection.widgetTitle}}"
20+
stepKey="grabWidgetTitle"/>
21+
<assertEquals stepKey="assertWidgetTitle">
22+
<actualResult type="string">$grabWidgetTitle</actualResult>
23+
<expectedResult type="string">{{title}}</expectedResult>
24+
</assertEquals>
25+
</actionGroup>
26+
</actionGroups>

app/code/Magento/CatalogWidget/Test/Mftf/Section/CatalogWidgetSection/InsertWidgetSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="checkElementStorefrontByPrice" type="button" selector="//*[@class='product-items widget-product-grid']//*[contains(text(),'${{arg4}}.00')]" parameterized="true"/>
2020
<element name="checkElementStorefrontByName" type="button" selector="//*[@class='product-items widget-product-grid']//*[@class='product-item'][{{productPosition}}]//a[contains(text(), '{{productName}}')]" parameterized="true"/>
2121
<element name="categoryTreeWrapper" type="text" selector=".rule-chooser .tree.x-tree"/>
22+
<element name="title" type="text" selector="input[name='parameters[title]']"/>
2223
</section>
2324
</sections>

0 commit comments

Comments
 (0)