Skip to content

Commit ee058c1

Browse files
authored
Merge branch '2.4-develop' into fix-for-issue-37812
2 parents 433919e + 6b34507 commit ee058c1

File tree

87 files changed

+1513
-749
lines changed

Some content is hidden

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

87 files changed

+1513
-749
lines changed

app/code/Magento/Backend/Model/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function add(Item $item, $parentId = null, $index = null)
8686
$index = (int) $index;
8787
if (!isset($this[$index])) {
8888
$this->offsetSet($index, $item);
89-
$this->_logger->info(
89+
$this->_logger->debug(
9090
sprintf('Add of item with id %s was processed', $item->getId())
9191
);
9292
} else {
@@ -151,7 +151,7 @@ public function remove($itemId)
151151
if ($item->getId() == $itemId) {
152152
unset($this[$key]);
153153
$result = true;
154-
$this->_logger->info(
154+
$this->_logger->debug(
155155
sprintf('Remove on item with id %s was processed', $item->getId())
156156
);
157157
break;

app/code/Magento/Backend/Model/Menu/Director/Director.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\Backend\Model\Menu\Director;
88

9+
use Magento\Backend\Model\Menu\Builder;
10+
use Magento\Backend\Model\Menu\Builder\AbstractCommand;
11+
use Psr\Log\LoggerInterface;
12+
913
/**
1014
* @api
1115
* @since 100.0.2
@@ -23,14 +27,14 @@ class Director extends \Magento\Backend\Model\Menu\AbstractDirector
2327
* Get command object
2428
*
2529
* @param array $data command params
26-
* @param \Psr\Log\LoggerInterface $logger
27-
* @return \Magento\Backend\Model\Menu\Builder\AbstractCommand
30+
* @param LoggerInterface $logger
31+
* @return AbstractCommand
2832
*/
2933
protected function _getCommand($data, $logger)
3034
{
3135
$command = $this->_commandFactory->create($data['type'], ['data' => $data]);
3236
if (isset($this->_messagePatterns[$data['type']])) {
33-
$logger->info(
37+
$logger->debug(
3438
sprintf($this->_messagePatterns[$data['type']], $command->getId())
3539
);
3640
}
@@ -41,14 +45,14 @@ protected function _getCommand($data, $logger)
4145
* Build menu instance
4246
*
4347
* @param array $config
44-
* @param \Magento\Backend\Model\Menu\Builder $builder
45-
* @param \Psr\Log\LoggerInterface $logger
48+
* @param Builder $builder
49+
* @param LoggerInterface $logger
4650
* @return void
4751
*/
4852
public function direct(
4953
array $config,
50-
\Magento\Backend\Model\Menu\Builder $builder,
51-
\Psr\Log\LoggerInterface $logger
54+
Builder $builder,
55+
LoggerInterface $logger
5256
) {
5357
foreach ($config as $data) {
5458
$builder->processCommand($this->_getCommand($data, $logger));

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ public function getNewEmptyItem()
316316
public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
317317
{
318318
if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC) {
319+
if (!$this->getStoreId()) {
320+
$this->setStoreId($this->_storeManager->getStore()->getId());
321+
}
319322
$this->addPriceData();
320323
if ($useRegularPrice) {
321324
$minimalPriceExpression = self::INDEX_TABLE_ALIAS . '.price';

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getValue()
140140
if (!$this->useRegularPrice) {
141141
$value = $this->discountCalculator->calculateDiscount($this->bundleProduct, $value);
142142
}
143-
$this->value = $this->priceCurrency->round($value);
143+
$this->value = $this->priceCurrency->roundPrice($value, 4);
144144
$product->setData($bundleSelectionKey, $this->value);
145145

146146
return $this->value;

app/code/Magento/Bundle/Pricing/Price/SpecialPrice.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getValue()
4343
}
4444

4545
$specialPrice = $this->getDiscountPercent();
46-
if ($specialPrice) {
46+
if ($specialPrice !== false) {
4747
$regularPrice = $this->getRegularPrice();
4848
$this->value = $regularPrice * ($specialPrice / 100);
4949
} else {
@@ -63,6 +63,8 @@ protected function getRegularPrice()
6363
}
6464

6565
/**
66+
* Returns true as special price is always percentage for bundle products
67+
*
6668
* @return bool
6769
*/
6870
public function isPercentageDiscount()

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ protected function setUp(): void
106106
$this->productMock->expects($this->atLeastOnce())
107107
->method('getPriceInfo')
108108
->willReturn($this->priceInfoMock);
109-
110-
$this->priceCurrencyMock = $this->getMockForAbstractClass(PriceCurrencyInterface::class);
111-
109+
110+
$this->priceCurrencyMock = $this->getMockBuilder(PriceCurrencyInterface::class)
111+
->disableOriginalConstructor()
112+
->addMethods(['roundPrice'])
113+
->getMockForAbstractClass();
114+
112115
$this->quantity = 1;
113116

114117
$this->setupSelectionPrice();
@@ -169,7 +172,7 @@ public function testGetValueTypeDynamic($useRegularPrice)
169172
}
170173

171174
$this->priceCurrencyMock->expects($this->once())
172-
->method('round')
175+
->method('roundPrice')
173176
->with($actualPrice)
174177
->willReturn($expectedPrice);
175178

@@ -234,7 +237,7 @@ public function testGetValueTypeFixedWithSelectionPriceType(bool $useRegularPric
234237
}
235238

236239
$this->priceCurrencyMock->expects($this->once())
237-
->method('round')
240+
->method('roundPrice')
238241
->with($actualPrice)
239242
->willReturn($expectedPrice);
240243

@@ -282,7 +285,7 @@ public function testGetValueTypeFixedWithoutSelectionPriceType($useRegularPrice)
282285
}
283286

284287
$this->priceCurrencyMock->expects($this->once())
285-
->method('round')
288+
->method('roundPrice')
286289
->with($actualPrice)
287290
->willReturn($expectedPrice);
288291

@@ -343,7 +346,7 @@ public function testFixedPriceWithMultipleQty($useRegularPrice)
343346
}
344347

345348
$this->priceCurrencyMock->expects($this->once())
346-
->method('round')
349+
->method('roundPrice')
347350
->with($actualPrice)
348351
->willReturn($expectedPrice);
349352

@@ -405,7 +408,7 @@ public function testGetAmount()
405408
->willReturn($price);
406409

407410
$this->priceCurrencyMock->expects($this->once())
408-
->method('round')
411+
->method('roundPrice')
409412
->with($price)
410413
->willReturn($price);
411414

app/code/Magento/Bundle/Test/Unit/Pricing/Price/SpecialPriceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public function getValueDataProvider()
135135
'percent' => 40],
136136
['regularPrice' => 75, 'specialPrice' => 40, 'isScopeDateInInterval' => false, 'value' => false,
137137
'percent' => null],
138+
['regularPrice' => 100, 'specialPrice' => 0, 'isScopeDateInInterval' => true, 'value' => 0,
139+
'percent' => 0],
138140
];
139141
}
140142
}

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1919
use Magento\ImportExport\Model\Import;
2020
use Magento\Store\Model\Store;
21+
use Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType as CatalogImportExportAbstractType;
2122
use Magento\Store\Model\StoreManagerInterface;
2223

2324
/**
@@ -26,7 +27,7 @@
2627
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2728
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829
*/
29-
class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType implements
30+
class Bundle extends CatalogImportExportAbstractType implements
3031
ResetAfterRequestInterface
3132
{
3233
/**
@@ -339,6 +340,31 @@ protected function populateSelectionTemplate($selection, $optionId, $parentId, $
339340
return $populatedSelection;
340341
}
341342

343+
/**
344+
* Set cache option selection
345+
*
346+
* @param array $existingSelection
347+
* @param string $optionTitle
348+
* @param string $selectIndex
349+
* @param string $key
350+
* @param string $origKey
351+
* @return void
352+
*/
353+
private function setCacheOptionSelection(
354+
array $existingSelection,
355+
string $optionTitle,
356+
string $selectIndex,
357+
string $key,
358+
string $origKey
359+
): void {
360+
if (!isset($this->_cachedOptions[$existingSelection['parent_product_id']]
361+
[$optionTitle]['selections'][$selectIndex][$key])
362+
) {
363+
$this->_cachedOptions[$existingSelection['parent_product_id']]
364+
[$optionTitle]['selections'][$selectIndex][$key] = $existingSelection[$origKey];
365+
}
366+
}
367+
342368
/**
343369
* Deprecated method for retrieving mapping between skus and products.
344370
*
@@ -353,7 +379,7 @@ protected function retrieveProducsByCachedSkus()
353379
/**
354380
* Retrieve mapping between skus and products.
355381
*
356-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
382+
* @return CatalogImportExportAbstractType
357383
*/
358384
protected function retrieveProductsByCachedSkus()
359385
{
@@ -372,7 +398,7 @@ protected function retrieveProductsByCachedSkus()
372398
/**
373399
* Save product type specific data.
374400
*
375-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
401+
* @return CatalogImportExportAbstractType
376402
*/
377403
public function saveData()
378404
{
@@ -476,7 +502,7 @@ protected function transformBundleCustomAttributes($rowData)
476502
/**
477503
* Populates existing options.
478504
*
479-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
505+
* @return CatalogImportExportAbstractType
480506
*/
481507
protected function populateExistingOptions()
482508
{
@@ -515,7 +541,9 @@ protected function populateExistingOptions()
515541
*
516542
* @param array $existingOptions
517543
*
518-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
544+
* @return CatalogImportExportAbstractType
545+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
546+
* @SuppressWarnings(PHPMD.NPathComplexity)
519547
*/
520548
protected function populateExistingSelections($existingOptions)
521549
{
@@ -530,20 +558,18 @@ protected function populateExistingSelections($existingOptions)
530558
);
531559
foreach ($existingSelections as $existingSelection) {
532560
$optionTitle = $existingOptions[$existingSelection['option_id']]['title'];
533-
$cachedOptionsSelections = $this->_cachedOptions[$existingSelection['parent_product_id']][$optionTitle]['selections'];
534-
foreach ($cachedOptionsSelections as $selectIndex => $selection) {
535-
$productId = $this->_cachedSkuToProducts[$selection['sku']];
536-
if ($productId == $existingSelection['product_id']) {
537-
foreach (array_keys($existingSelection) as $origKey) {
538-
$key = $this->_bundleFieldMapping[$origKey] ?? $origKey;
539-
if (
540-
!isset($this->_cachedOptions[$existingSelection['parent_product_id']][$optionTitle]['selections'][$selectIndex][$key])
541-
) {
542-
$this->_cachedOptions[$existingSelection['parent_product_id']][$optionTitle]['selections'][$selectIndex][$key] =
543-
$existingSelection[$origKey];
561+
if (array_key_exists($existingSelection['parent_product_id'], $this->_cachedOptions)) {
562+
$cachedOptionsSelections = $this->_cachedOptions[$existingSelection['parent_product_id']][$optionTitle]['selections'];
563+
foreach ($cachedOptionsSelections as $selectIndex => $selection) {
564+
$productId = $this->_cachedSkuToProducts[$selection['sku']];
565+
if ($productId == $existingSelection['product_id']) {
566+
foreach (array_keys($existingSelection) as $origKey) {
567+
$key = $this->_bundleFieldMapping[$origKey] ?? $origKey;
568+
$this->setCacheOptionSelection($existingSelection, (string) $optionTitle,
569+
(string) $selectIndex, (string) $key, (string) $origKey);
544570
}
571+
break;
545572
}
546-
break;
547573
}
548574
}
549575
}
@@ -554,7 +580,7 @@ protected function populateExistingSelections($existingOptions)
554580
/**
555581
* Insert options.
556582
*
557-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
583+
* @return CatalogImportExportAbstractType
558584
*/
559585
protected function insertOptions()
560586
{
@@ -630,7 +656,7 @@ protected function populateInsertOptionValues(array $optionIds): array
630656
/**
631657
* Insert selections.
632658
*
633-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
659+
* @return CatalogImportExportAbstractType
634660
*/
635661
protected function insertSelections()
636662
{
@@ -664,7 +690,7 @@ protected function insertSelections()
664690
/**
665691
* Insert parent/child product relations
666692
*
667-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
693+
* @return CatalogImportExportAbstractType
668694
*/
669695
private function insertParentChildRelations()
670696
{
@@ -720,7 +746,7 @@ protected function _initAttributes()
720746
*
721747
* @param array $productIds
722748
*
723-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
749+
* @return CatalogImportExportAbstractType
724750
*/
725751
protected function deleteOptionsAndSelections($productIds)
726752
{
@@ -762,7 +788,7 @@ protected function deleteOptionsAndSelections($productIds)
762788
/**
763789
* Clear cached values between bunches
764790
*
765-
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
791+
* @return CatalogImportExportAbstractType
766792
*/
767793
protected function clear()
768794
{

app/code/Magento/Catalog/Api/ProductAttributeIsFilterableManagementInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?php
22
/************************************************************************
33
*
4-
* ADOBE CONFIDENTIAL
5-
* ___________________
6-
*
7-
* Copyright 2014 Adobe
4+
* Copyright 2023 Adobe
85
* All Rights Reserved.
96
*
107
* NOTICE: All information contained herein is, and remains

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/**
1313
* Product options block
1414
*
15-
* @author Magento Core Team <core@magentocommerce.com>
1615
* @api
1716
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1817
* @since 100.0.2
@@ -39,7 +38,7 @@ class Options extends \Magento\Framework\View\Element\Template
3938
protected $_registry = null;
4039

4140
/**
42-
* Catalog product
41+
* Product
4342
*
4443
* @var Product
4544
*/
@@ -175,7 +174,17 @@ protected function _getPriceConfiguration($option)
175174
$data = [
176175
'prices' => [
177176
'oldPrice' => [
178-
'amount' => $this->pricingHelper->currency($option->getRegularPrice(), false, false),
177+
'amount' => $this->_catalogData->getTaxPrice(
178+
$option->getProduct(),
179+
$option->getRegularPrice(),
180+
true,
181+
null,
182+
null,
183+
null,
184+
null,
185+
null,
186+
false
187+
),
179188
'adjustments' => [],
180189
],
181190
'basePrice' => [

0 commit comments

Comments
 (0)