Skip to content

Commit 06a070c

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-gl/magento2ce into ACQE-6695
2 parents d9d3e70 + c3ab314 commit 06a070c

File tree

171 files changed

+4208
-560
lines changed

Some content is hidden

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

171 files changed

+4208
-560
lines changed

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
<element name="errorMessage" type="text" selector=".message.message-error.error"/>
2424
<element name="warningMessage" type="text" selector=".message-warning"/>
2525
<element name="noticeMessage" type="text" selector=".message-notice"/>
26+
<element name="assertCacheManagementConfigurationStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'CONFIG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
27+
<element name="assertCacheManagementLayoutsStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'LAYOUT_GENERAL_CACHE_TAG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
2628
</section>
2729
</sections>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2024 Adobe
6+
* All Rights Reserved.
7+
*
8+
* ************************************************************************
9+
*/
10+
-->
11+
12+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
14+
<test name="AdminOrderCreateAfterHtmlMinificationTest">
15+
<annotations>
16+
<features value="Backend"/>
17+
<stories value="Admin Panel with HTML minification"/>
18+
<title value="Admin panel should allow order creation with HTML minification enabled"/>
19+
<description value="Admin panel should allow order creation with HTML minification enabled"/>
20+
<testCaseId value="AC-12329"/>
21+
<useCaseId value="ACP2E-3169"/>
22+
<severity value="MAJOR"/>
23+
<group value="backend"/>
24+
<group value="cloud"/>
25+
</annotations>
26+
<before>
27+
<magentoCLI command="config:set {{MinifyHtmlFilesEnableConfigData.path}} {{MinifyHtmlFilesEnableConfigData.value}}" stepKey="enableHtmlMinification"/>
28+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
29+
<argument name="tags" value="config"/>
30+
</actionGroup>
31+
<magentoCLI command="setup:static-content:deploy -f" stepKey="deployStaticContent"/>
32+
<createData entity="Simple_US_Customer_CA" stepKey="createSimpleCustomer"/>
33+
<createData entity="ApiProductWithDescription" stepKey="createSimpleProduct"/>
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
35+
</before>
36+
<after>
37+
<magentoCLI command="config:set {{MinifyHtmlFilesDisableConfigData.path}} {{MinifyHtmlFilesDisableConfigData.value}}" stepKey="disableHtmlMinification"/>
38+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
39+
<argument name="tags" value="config"/>
40+
</actionGroup>
41+
<magentoCLI command="setup:static-content:deploy -f" stepKey="deployStaticContent"/>
42+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
43+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
44+
<deleteData createDataKey="createSimpleCustomer" stepKey="deleteSimpleCustomer"/>
45+
</after>
46+
<waitForPageLoad stepKey="waitForPageLoadOnDashboard"/>
47+
<actionGroup ref="AssertAdminPageTitleActionGroup" stepKey="seeDashboardTitle">
48+
<argument name="value" value="Dashboard"/>
49+
</actionGroup>
50+
<actionGroup ref="CreateOrderActionGroup" stepKey="createOrder">
51+
<argument name="product" value="$$createSimpleProduct$$"/>
52+
<argument name="customer" value="$$createSimpleCustomer$$"/>
53+
</actionGroup>
54+
</test>
55+
</tests>

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,13 @@ define([
141141
* @returns {Object} Chainable.
142142
*/
143143
initElements: function (data) {
144-
var newData = this.getNewData(data),
145-
recordIndex;
144+
var newData = this.getNewData(data);
146145

147146
this.parsePagesData(data);
148147

149148
if (newData.length) {
150149
if (this.insertData().length) {
151-
recordIndex = data.length - newData.length - 1;
152-
153-
_.each(newData, function (newRecord) {
154-
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
155-
}, this);
150+
this.parseProcessingAddChild(data, newData);
156151
}
157152
}
158153

@@ -181,6 +176,23 @@ define([
181176
this.reload();
182177
}
183178
}, this);
179+
},
180+
181+
/**
182+
* Parse and processing the add child method to update the latest records if the record index is not a number.
183+
*
184+
* @param {Array} data
185+
* @param {Array} newData
186+
*/
187+
parseProcessingAddChild: function (data, newData) {
188+
let recordIndex;
189+
190+
recordIndex = data.length - newData.length - 1;
191+
if (!isNaN(recordIndex)) {
192+
_.each(newData, function (newRecord) {
193+
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
194+
}, this);
195+
}
184196
}
185197
});
186198
});

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ define([
7474
let bundleSelections = registry.get(this.name + '.' + index + '.' + this.bundleSelectionsName);
7575

7676
bundleSelections.destroyChildren();
77+
bundleSelections._elems.clear();
7778
},
7879

7980
/**

app/code/Magento/BundleGraphQl/Model/Cart/BundleOptionDataProvider.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Quote\Model\Quote\Item;
1515
use Magento\Framework\Pricing\Helper\Data;
1616
use Magento\Framework\Serialize\SerializerInterface;
17+
use Magento\Bundle\Model\Product\OriginalPrice;
1718

1819
/**
1920
* Data provider for bundled product options
@@ -25,39 +26,23 @@ class BundleOptionDataProvider
2526
*/
2627
private const OPTION_TYPE = 'bundle';
2728

28-
/**
29-
* @var Data
30-
*/
31-
private $pricingHelper;
32-
33-
/**
34-
* @var SerializerInterface
35-
*/
36-
private $serializer;
37-
38-
/**
39-
* @var Configuration
40-
*/
41-
private $configuration;
42-
4329
/** @var Uid */
4430
private $uidEncoder;
4531

4632
/**
4733
* @param Data $pricingHelper
4834
* @param SerializerInterface $serializer
4935
* @param Configuration $configuration
36+
* @param OriginalPrice $originalPrice
5037
* @param Uid|null $uidEncoder
5138
*/
5239
public function __construct(
53-
Data $pricingHelper,
54-
SerializerInterface $serializer,
55-
Configuration $configuration,
40+
private readonly Data $pricingHelper,
41+
private readonly SerializerInterface $serializer,
42+
private readonly Configuration $configuration,
43+
private readonly OriginalPrice $originalPrice,
5644
Uid $uidEncoder = null
5745
) {
58-
$this->pricingHelper = $pricingHelper;
59-
$this->serializer = $serializer;
60-
$this->configuration = $configuration;
6146
$this->uidEncoder = $uidEncoder ?: ObjectManager::getInstance()
6247
->get(Uid::class);
6348
}
@@ -139,28 +124,34 @@ private function buildBundleOptionValues(array $selections, Item $item): array
139124
$values = [];
140125

141126
$product = $item->getProduct();
127+
$currencyCode = $item->getQuote()->getQuoteCurrencyCode();
142128
foreach ($selections as $selection) {
143129
$qty = (float) $this->configuration->getSelectionQty($product, $selection->getSelectionId());
144130
if (!$qty) {
145131
continue;
146132
}
147-
148133
$selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
149134
$optionDetails = [
150135
self::OPTION_TYPE,
151136
$selection->getData('option_id'),
152137
$selection->getData('selection_id'),
153138
(int) $selection->getData('selection_qty')
154139
];
140+
$price = $this->pricingHelper->currency($selectionPrice, false, false);
155141
$values[] = [
156142
'id' => $selection->getSelectionId(),
157143
'uid' => $this->uidEncoder->encode(implode('/', $optionDetails)),
158144
'label' => $selection->getName(),
159145
'quantity' => $qty,
160-
'price' => $this->pricingHelper->currency($selectionPrice, false, false),
146+
'price' => $price,
147+
'priceV2' => ['currency' => $currencyCode, 'value' => $price],
148+
'original_price' => [
149+
'currency' => $currencyCode,
150+
'value' => $this->originalPrice
151+
->getSelectionOriginalPrice($item->getProduct(), $selection)
152+
],
161153
];
162154
}
163-
164155
return $values;
165156
}
166157
}

app/code/Magento/BundleGraphQl/etc/schema.graphqls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ type SelectedBundleOptionValue @doc(description: "Contains details about a value
4444
uid: ID! @doc(description: "The unique ID for a `SelectedBundleOptionValue` object")
4545
label: String! @doc(description: "The display name of the value for the selected bundle product option.")
4646
quantity: Float! @doc(description: "The quantity of the value for the selected bundle product option.")
47-
price: Float! @doc(description: "The price of the value for the selected bundle product option.")
47+
price: Float! @deprecated(reason: "Use priceV2 instead.") @doc(description: "The price of the value for the selected bundle product option.")
48+
priceV2: Money! @doc(description: "The price of the value for the selected bundle product option.")
49+
original_price: Money! @doc(description: "The original price of the value for the selected bundle product option.")
4850
}
4951

5052
type PriceDetails @doc(description: "Can be used to retrieve the main price details in case of bundle product") {
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateLayoutConfigurationTest">
11+
<annotations>
12+
<features value="Cache"/>
13+
<stories value="Cache Management"/>
14+
<title value="Validate Configuration Cache Type"/>
15+
<description value="Validate Configuration Cache Type After Cache Management"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-4231"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createPreReqCategory"/>
24+
</createData>
25+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage"/>
26+
<waitForText selector="{{AdminMessagesSection.assertCacheManagementConfigurationStatus}}" userInput="ENABLED" stepKey="verifyCacheTypeConfigurationIsENABLED"/>
27+
</before>
28+
<after>
29+
<!-- Delete category -->
30+
<deleteData createDataKey="createPreReqCategory" stepKey="deleteCategory"/>
31+
<!-- Delete product -->
32+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
33+
<!--Restore currency symbols to default-->
34+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPageToRestore"/>
35+
<checkOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="checkConfigSettingsMessage"/>
36+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbolAgain"/>
37+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbolsToRestore"/>
38+
<!-- Flush Cache-->
39+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterRevokingTheChangesToDefault">
40+
<argument name="tags" value="" />
41+
</actionGroup>
42+
<!-- Log out -->
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
<!-- Validate Storefront -->
46+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront">
47+
<argument name="page" value="$$createProduct.name$$.html"/>
48+
</actionGroup>
49+
<!--Assert Currency symbol-->
50+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="waitForCurrencySymbolInStoreFront"/>
51+
<!-- Navigate To Currency Symbol-->
52+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/>
53+
<!--Replace standard currency symbol by custom currency symbol-->
54+
<uncheckOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="uncheckConfigSettingsMessage"/>
55+
<fillField selector="{{AdminCurrencySymbolsGridSection.inputCurrencySymbol}}" userInput="£" stepKey="fillDefaultLabel"/>
56+
<!--Save custom currency symbol-->
57+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbol"/>
58+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbols"/>
59+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencySymbolMessageData.success}}" stepKey="seeSuccessMessage"/>
60+
<!--Navigate To Product Storefront-->
61+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront1">
62+
<argument name="page" value="$$createProduct.name$$.html"/>
63+
</actionGroup>
64+
<!--Assert Currency symbol is not changed-->
65+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="verifyCurrencySymbolIsNotChangedBeforeFlushingTheChangesInStoreFront"/>
66+
<!--Navigate to Cache Management-->
67+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage1"/>
68+
<!-- Flush Cache-->
69+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterChangesMade">
70+
<argument name="tags" value="" />
71+
</actionGroup>
72+
<!--Navigate To Product Storefront-->
73+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront2">
74+
<argument name="page" value="$$createProduct.name$$.html"/>
75+
</actionGroup>
76+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="£" stepKey="verifyCurrencySymbolIsChangedAfterFlushingTheChangesInStoreFront"/>
77+
</test>
78+
</tests>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateLayoutsCacheTypeTest">
11+
<annotations>
12+
<features value="Cache"/>
13+
<stories value="Cache Management"/>
14+
<title value="Validate layouts Cache Type"/>
15+
<description value="Validate layouts Cache Type After Cache Management"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-4221"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createPreReqCategory"/>
24+
</createData>
25+
</before>
26+
<after>
27+
<!-- Delete category -->
28+
<deleteData createDataKey="createPreReqCategory" stepKey="deleteCategory"/>
29+
<!-- Delete product -->
30+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
31+
<!--Restore currency symbols to default-->
32+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPageToRestore"/>
33+
<checkOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="checkConfigSettingsMessage"/>
34+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbolAgain"/>
35+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbolsToRestore"/>
36+
<!-- Flush Cache-->
37+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterRevokingTheChangesToDefault">
38+
<argument name="tags" value="" />
39+
</actionGroup>
40+
<!-- Log out -->
41+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
42+
</after>
43+
<!-- Validate Storefront -->
44+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront">
45+
<argument name="page" value="$$createProduct.name$$.html"/>
46+
</actionGroup>
47+
<!--Assert Currency symbol-->
48+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="waitForCurrencySymbolInStoreFront"/>
49+
<!-- Navigate To Currency Symbol-->
50+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/>
51+
<!--Replace standard currency symbol by custom currency symbol-->
52+
<uncheckOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="uncheckConfigSettingsMessage"/>
53+
<fillField selector="{{AdminCurrencySymbolsGridSection.inputCurrencySymbol}}" userInput="£" stepKey="fillDefaultLabel"/>
54+
<!--Save custom currency symbol-->
55+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbol"/>
56+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbols"/>
57+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencySymbolMessageData.success}}" stepKey="seeSuccessMessage"/>
58+
<!--Navigate To Product Storefront-->
59+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront1">
60+
<argument name="page" value="$$createProduct.name$$.html"/>
61+
</actionGroup>
62+
<!--Assert Currency symbol is not changed-->
63+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="verifyCurrencySymbolIsNotChangedBeforeFlushingTheChangesInStoreFront"/>
64+
<!-- Flush Cache-->
65+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterChangesMade">
66+
<argument name="tags" value="" />
67+
</actionGroup>
68+
<!--Navigate To Product Storefront-->
69+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront2">
70+
<argument name="page" value="$$createProduct.name$$.html"/>
71+
</actionGroup>
72+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="£" stepKey="verifyCurrencySymbolIsChangedAfterFlushingTheChangesInStoreFront"/>
73+
</test>
74+
</tests>

app/code/Magento/Catalog/Model/Product.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,8 +1877,10 @@ public function toArray(array $arrAttributes = [])
18771877
{
18781878
$data = parent::toArray($arrAttributes);
18791879
$stock = $this->getStockItem();
1880-
if ($stock) {
1880+
if (is_object($stock) && method_exists($stock, 'toArray')) {
18811881
$data['stock_item'] = $stock->toArray();
1882+
} elseif (is_array($stock)) {
1883+
$data['stock_item'] = $stock;
18821884
}
18831885
unset($data['stock_item']['product']);
18841886
return $data;

0 commit comments

Comments
 (0)