Skip to content

Commit dc85981

Browse files
authored
Merge branch '2.4-develop' into fix-for-issue-38831
2 parents d1b4e3d + 11e7d89 commit dc85981

File tree

88 files changed

+1531
-258
lines changed

Some content is hidden

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

88 files changed

+1531
-258
lines changed

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") {

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;
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminChangeProductNameAsPerStoreViewScopeActionGroup">
12+
<annotations>
13+
<description>Admin change product name having store view scope</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string"/>
17+
</arguments>
18+
<waitForElementClickable selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="waitForDefaultNameCheckBox"/>
19+
<uncheckOption selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="unCheckDefaultNameCheckbox"/>
20+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="changeProductName"/>
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313
<data key="attributeGroupId">7</data>
1414
<data key="skeletonId">4</data>
1515
</entity>
16+
<entity name="CatalogAdditionalAttributeSet" type="CatalogAttributeSet">
17+
<data key="attribute_set_name" unique="suffix">additional_set_</data>
18+
<data key="attributeGroupId">7</data>
19+
<data key="skeletonId">4</data>
20+
</entity>
1621
</entities>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection/AdminProductFormRelatedUpSellCrossSellSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
<element name="removeCrossSellProduct" type="button" selector="//span[text()='Cross-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2424
<element name="removeUpsellProduct" type="button" selector="//span[text()='Up-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2525
<element name="relatedUpSellCrossSellProductStagingSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='{{catalogStagingSection}}']" parameterized="true"/>
26+
<element name="relatedProductStatus" type="text" selector="//div[@class='admin__field-control']//div[@class='control-table-text']//span[@data-index='status']"/>
2627
</section>
2728
</sections>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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="AdminChangeRelatedProductPropertiesOnStoreViewLevelTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Product properties as per store view"/>
14+
<title value="Change related product properties on store view level"/>
15+
<description value="Change name and status of product properties on diferrent store view levels"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-4491"/>
18+
</annotations>
19+
<before>
20+
<!-- Login as admin -->
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<!--Create product A-->
23+
<createData entity="SimpleProduct" stepKey="createSimpleProductA"/>
24+
<!--Create product B-->
25+
<createData entity="SimpleProduct" stepKey="createSimpleProductB"/>
26+
<!--Create website 1-->
27+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite1">
28+
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
29+
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
30+
</actionGroup>
31+
<!-- Create store 1-->
32+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createStore1">
33+
<argument name="website" value="{{NewWebSiteData.name}}"/>
34+
<argument name="storeGroupName" value="{{NewWebSiteData.name}}"/>
35+
<argument name="storeGroupCode" value="{{NewWebSiteData.code}}"/>
36+
</actionGroup>
37+
<!-- Create store view 1-->
38+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView1">
39+
<argument name="StoreGroup" value="NewWebSiteData"/>
40+
<argument name="customStore" value="NewWebSiteData"/>
41+
</actionGroup>
42+
<!--Create website 2-->
43+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite2">
44+
<argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/>
45+
<argument name="websiteCode" value="{{secondCustomWebsite.code}}"/>
46+
</actionGroup>
47+
<!-- Create store 2-->
48+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createStore2">
49+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
50+
<argument name="storeGroupName" value="{{secondCustomWebsite.name}}"/>
51+
<argument name="storeGroupCode" value="{{secondCustomWebsite.code}}"/>
52+
</actionGroup>
53+
<!-- Create store view 2-->
54+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView2">
55+
<argument name="StoreGroup" value="secondCustomWebsite"/>
56+
<argument name="customStore" value="secondCustomWebsite"/>
57+
</actionGroup>
58+
</before>
59+
<after>
60+
<!--Delete product-->
61+
<deleteData createDataKey="createSimpleProductA" stepKey="deleteSimpleProductA"/>
62+
<!--Delete product-->
63+
<deleteData createDataKey="createSimpleProductB" stepKey="deleteSimpleProductB"/>
64+
<!--Delete website 1-->
65+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite1">
66+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
67+
</actionGroup>
68+
<!--Delete website 2-->
69+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite2">
70+
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
71+
</actionGroup>
72+
<!--Logout as Admin-->
73+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/>
74+
</after>
75+
<!--Open simple product A-->
76+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSimpleProductA">
77+
<argument name="productId" value="$$createSimpleProductA.id$$"/>
78+
</actionGroup>
79+
<!--Assign product A to website 1-->
80+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductAtoWebsite1">
81+
<argument name="website" value="{{NewWebSiteData.name}}"/>
82+
</actionGroup>
83+
<!--Assign product A to website 2-->
84+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductAtoWebsit2">
85+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
86+
</actionGroup>
87+
<!--Add simple product B as related product-->
88+
<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addProductBasRelatedProduct">
89+
<argument name="sku" value="$$createSimpleProductB.sku$$"/>
90+
</actionGroup>
91+
<!--Save product A-->
92+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductA"/>
93+
<!--Open simple product B-->
94+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSimpleProductB">
95+
<argument name="productId" value="$$createSimpleProductB.id$$"/>
96+
</actionGroup>
97+
<!--Assign product B to website 1-->
98+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductBtoWebsite1">
99+
<argument name="website" value="{{NewWebSiteData.name}}"/>
100+
</actionGroup>
101+
<!--Assign product B to website 2-->
102+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductBtoWebsite2">
103+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
104+
</actionGroup>
105+
<!--Save product B-->
106+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductB"/>
107+
<!--Change Scope to store view 2-->
108+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="changeScopeToStoreView2">
109+
<argument name="storeViewName" value="{{secondCustomWebsite.name}}"/>
110+
</actionGroup>
111+
<!--Uncheck default product status-->
112+
<waitForElementVisible selector="{{AdminProductFormSection.productStatusUseDefault}}" stepKey="waitForDefaultValueCheckBox"/>
113+
<uncheckOption selector="{{AdminProductFormSection.productStatusUseDefault}}" stepKey="uncheckDefaultProductStatus"/>
114+
<!-- Change status of product to "Disable" and save it having scope as Website-->
115+
<actionGroup ref="AdminSetProductDisabledActionGroup" stepKey="disableProductStatusHavingScopeWebsite"/>
116+
<!--Change product name having scope as store view-->
117+
<actionGroup ref="AdminChangeProductNameAsPerStoreViewScopeActionGroup" stepKey="changeProductNameHavingScopeStoreView">
118+
<argument name="productName" value="B2"/>
119+
</actionGroup>
120+
<!--Save product B-->
121+
<actionGroup ref="SaveProductFormActionGroup" stepKey="againSaveProductB"/>
122+
<!--Open simple product A again-->
123+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSimpleProductAagain">
124+
<argument name="productId" value="$$createSimpleProductA.id$$"/>
125+
</actionGroup>
126+
<!--Switch scope to store view 1-->
127+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchScopeToStoreView1">
128+
<argument name="storeViewName" value="{{NewWebSiteData.name}}"/>
129+
</actionGroup>
130+
<!--Expand "Related Products" tab-->
131+
<conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openRelatedProductTab"/>
132+
<!--Assert product name and status as per store view 1-->
133+
<waitForText selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$createSimpleProductB.name$$" stepKey="assertView1ProductName"/>
134+
<waitForText selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductStatus}}" userInput="Enabled" stepKey="assertView1ProductStatus"/>
135+
<!--Switch scope to store view 2-->
136+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchScopeToStoreView2">
137+
<argument name="storeViewName" value="{{secondCustomWebsite.name}}"/>
138+
</actionGroup>
139+
<!--Expand "Related Products" tab-->
140+
<conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="expandRelatedProductTab"/>
141+
<!--Assert product name and status as per store view 2-->
142+
<waitForText selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="B2" stepKey="assertView2ProductName"/>
143+
<waitForText selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedProductStatus}}" userInput="Disabled" stepKey="assertView2ProductStatus"/>
144+
</test>
145+
</tests>

app/code/Magento/Customer/Model/Attribute/Data/Multiline.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* Customer Attribute Multiply line Data Model
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Customer\Model\Attribute\Data;
1311

app/code/Magento/Customer/Model/Attribute/Data/Multiselect.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* Customer Attribute Multiply select Data Model
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Customer\Model\Attribute\Data;
1311

app/code/Magento/Customer/Model/Attribute/Data/Select.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* Customer Attribute Select Data Model
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
119
*/
1210
namespace Magento\Customer\Model\Attribute\Data;
1311

0 commit comments

Comments
 (0)