Skip to content

Commit 5298b6d

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento/magento2ce into MC-38263
2 parents 5c29342 + 912ceab commit 5298b6d

File tree

613 files changed

+8187
-108857
lines changed

Some content is hidden

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

613 files changed

+8187
-108857
lines changed

app/code/Magento/Backend/view/adminhtml/templates/dashboard/chart.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $viewModel = $block->getViewModel();
1919
?>
2020
<div class="dashboard-diagram">
2121
<div class="dashboard-diagram-graph">
22-
<canvas id="chart_<?= $escaper->escapeHtmlAttr($block->getData('html_id')) ?>_period"/>
22+
<canvas id="chart_<?= $escaper->escapeHtmlAttr($block->getData('html_id')) ?>_period"></canvas>
2323
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
2424
'display:none',
2525
'#chart_' . $escaper->escapeJs($block->getData('html_id')) . '_period'

app/code/Magento/Backend/view/adminhtml/web/js/store-switcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ define([
6969

7070
} else {
7171
$('#preview_selected_store').val(scopeId);
72-
$('#preview_form').submit();
72+
$('#preview_form').trigger('submit');
7373

7474
$('.store-switcher .dropdown-menu li a').each(function () {
7575
var $this = $(this);

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,26 @@ public function getJsonConfig()
177177
{
178178
/* @var $product \Magento\Catalog\Model\Product */
179179
$product = $this->getProduct();
180+
$tierPrices = [];
181+
$priceInfo = $product->getPriceInfo();
182+
$tierPricesList = $priceInfo->getPrice('tier_price')->getTierPriceList();
183+
foreach ($tierPricesList as $tierPrice) {
184+
$tierPriceData = [
185+
'qty' => $tierPrice['price_qty'],
186+
'price' => $tierPrice['website_price'],
187+
];
188+
$tierPrices[] = $tierPriceData;
189+
}
180190

181191
if (!$this->hasOptions()) {
182192
$config = [
183193
'productId' => $product->getId(),
184-
'priceFormat' => $this->_localeFormat->getPriceFormat()
194+
'priceFormat' => $this->_localeFormat->getPriceFormat(),
195+
'tierPrices' => $tierPrices
185196
];
186197
return $this->_jsonEncoder->encode($config);
187198
}
188199

189-
$tierPrices = [];
190-
$priceInfo = $product->getPriceInfo();
191-
$tierPricesList = $priceInfo->getPrice('tier_price')->getTierPriceList();
192-
foreach ($tierPricesList as $tierPrice) {
193-
$tierPrices[] = $tierPrice['price']->getValue() * 1;
194-
}
195200
$config = [
196201
'productId' => (int)$product->getId(),
197202
'priceFormat' => $this->_localeFormat->getPriceFormat(),

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
158158
$option->setData('product_id', $product->getData($metadata->getLinkField()));
159159
$option->setData('store_id', $product->getStoreId());
160160

161+
$backedOptions = $option->getValues();
161162
if ($option->getOptionId()) {
162163
$options = $product->getOptions();
163164
if (!$options) {
@@ -174,6 +175,9 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
174175
}
175176
$originalValues = $persistedOption->getValues();
176177
$newValues = $option->getData('values');
178+
if (!$newValues) {
179+
$newValues = $this->getOptionValues($option);
180+
}
177181
if ($newValues) {
178182
if (isset($originalValues)) {
179183
$newValues = $this->markRemovedValues($newValues, $originalValues);
@@ -182,6 +186,8 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
182186
}
183187
}
184188
$option->save();
189+
// Required for API response data consistency
190+
$option->setValues($backedOptions);
185191
return $option;
186192
}
187193

@@ -249,4 +255,28 @@ private function getHydratorPool()
249255
}
250256
return $this->hydratorPool;
251257
}
258+
259+
/**
260+
* Get Option values from property
261+
*
262+
* Gets Option values stored in property, modifies for needed format and clears the property
263+
*
264+
* @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option
265+
* @return array|null
266+
*/
267+
private function getOptionValues(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option): ?array
268+
{
269+
if ($option->getValues() === null) {
270+
return null;
271+
}
272+
273+
$optionValues = [];
274+
275+
foreach ($option->getValues() as $optionValue) {
276+
$optionValues[] = $optionValue->getData();
277+
}
278+
$option->setValues(null);
279+
280+
return $optionValues;
281+
}
252282
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public function factory($product)
127127

128128
$typeModel = $this->_productTypePool->get($typeModelName);
129129
$typeModel->setConfig($types[$typeId]);
130+
$typeModel->setTypeId($typeId);
131+
130132
return $typeModel;
131133
}
132134

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,9 @@ protected function _removeNotApplicableAttributes($product)
752752
*/
753753
public function beforeSave($product)
754754
{
755+
if (!$product->getTypeId()) {
756+
$product->setTypeId($this->_typeId);
757+
}
755758
$this->_removeNotApplicableAttributes($product);
756759
$product->canAffectOptions(true);
757760
return $this;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function retrieveProductIdsBySkus(array $skus)
124124
private function truncateToLimit()
125125
{
126126
if (count($this->idsBySku) > $this->idsLimit) {
127-
$this->idsBySku = array_slice($this->idsBySku, round($this->idsLimit / -2));
127+
$this->idsBySku = array_slice($this->idsBySku, $this->idsLimit * -1, null, true);
128128
}
129129
}
130130
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddAdvancedPricingToTheProductExtendedActionGroup.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
<remove keyForRemoval="selectProductTierPriceCustomerGroupInput"/>
1717
<click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect(index)}}" stepKey="clickProductTierPriceCustGroupSelect" after="selectProductTierPriceWebsiteInput"/>
18-
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" time="30" stepKey="waitProductTierPriceGroupOrCatalogOption" after="clickProductTierPriceCustGroupSelect"/>
19-
<click selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption(groupPrice.customer_group)}}" stepKey="clickAllGroupsOption" after="waitProductTierPriceGroupOrCatalogOption"/>
18+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupFilterInputByIndex(index)}}" time="30" stepKey="waitProductTierPriceGroupOrCatalogOption" after="clickProductTierPriceCustGroupSelect"/>
19+
<selectMultipleOptions filterSelector="{{AdminProductFormAdvancedPricingSection.customerGroupFilterInputByIndex(index)}}" optionSelector="{{AdminProductFormAdvancedPricingSection.customerGroupOptionByIndex(index)}}" stepKey="clickAllGroupsOption" after="waitProductTierPriceGroupOrCatalogOption">
20+
<array>['{{groupPrice.customer_group}}']</array>
21+
</selectMultipleOptions>
2022
</actionGroup>
2123
</actionGroups>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,18 @@
8686
<data key="price">0.1</data>
8787
<data key="qty">1</data>
8888
</entity>
89+
<entity name="tierPriceForAllGroups" type="data">
90+
<data key="price">80</data>
91+
<data key="price_type">fixed</data>
92+
<data key="website_id">0</data>
93+
<data key="customer_group">ALL GROUPS</data>
94+
<data key="quantity">2</data>
95+
</entity>
96+
<entity name="tierPriceForGeneralGroup" type="data">
97+
<data key="price">70</data>
98+
<data key="price_type">fixed</data>
99+
<data key="website_id">0</data>
100+
<data key="customer_group">General</data>
101+
<data key="quantity">3</data>
102+
</entity>
89103
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<element name="msrpType" type="select" selector="//select[@name='product[msrp_display_actual_price_type]']" timeout="30"/>
2727
<element name="save" type="button" selector="#save-button" timeout="30"/>
2828
<element name="modalTitle" type="text" selector="aside.product_form_product_form_advanced_pricing_modal h1.modal-title"/>
29+
<element name="customerGroupFilterInputByIndex" type="input" selector="div[name='product[tier_price][{{rowIndex}}][cust_group]'] div.admin__action-multiselect-search-wrap input" parameterized="true"/>
30+
<element name="customerGroupOptionByIndex" type="text" selector="//div[@name='product[tier_price][{{rowIndex}}][cust_group]']//label[@class='admin__action-multiselect-label']//span" parameterized="true"/>
2931
<!-- Last row tier price elements-->
3032
<element name="lastTierPriceWebsite" type="select" selector="[data-index='tier_price'] table tbody tr.data-row:last-child [name*='[website_id]']"/>
3133
<element name="lastTierPriceCustomerGroup" type="select" selector="[data-index='tier_price'] table tbody tr.data-row:last-child [name*='[cust_group]']"/>

0 commit comments

Comments
 (0)