Skip to content

Commit 1501567

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
Merge remote-tracking branch 'origin/2.4-develop' into ACP2E-3504
2 parents 1323166 + d253a44 commit 1501567

File tree

49 files changed

+1540
-113
lines changed

Some content is hidden

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

49 files changed

+1540
-113
lines changed

app/code/Magento/Bundle/Pricing/Adjustment/DefaultSelectionPriceListProvider.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2016 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Bundle\Pricing\Adjustment;
@@ -173,12 +173,9 @@ private function addMiniMaxPriceList(Product $bundleProduct, $selectionsCollecti
173173
*/
174174
private function addMaximumMultiSelectionPriceList(Product $bundleProduct, $selectionsCollection, $useRegularPrice)
175175
{
176-
$websiteId = null;
177-
if (!$this->catalogData->isPriceGlobal()) {
178-
$websiteId = (int)$this->storeManager->getStore()->getWebsiteId();
179-
if ($websiteId === 0) {
180-
$websiteId = $this->websiteRepository->getDefault()->getId();
181-
}
176+
$websiteId = (int)$this->storeManager->getStore()->getWebsiteId();
177+
if ($websiteId === 0) {
178+
$websiteId = $this->websiteRepository->getDefault()->getId();
182179
}
183180
$selectionsCollection->addPriceData(null, $websiteId);
184181

app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/DefaultSelectionPriceListProviderTest.php

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2022 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -189,7 +189,10 @@ public function testGetPriceList(): void
189189
$this->model->getPriceList($this->product, false, false);
190190
}
191191

192-
public function testGetPriceListForFixedPriceType(): void
192+
/**
193+
* @dataProvider dataProvider
194+
*/
195+
public function testGetPriceListForFixedPriceType($websiteId): void
193196
{
194197
$optionId = 1;
195198

@@ -218,13 +221,19 @@ public function testGetPriceListForFixedPriceType(): void
218221
->willReturn($this->store);
219222
$this->store->expects($this->once())
220223
->method('getWebsiteId')
221-
->willReturn(0);
222-
$this->websiteRepository->expects($this->once())
223-
->method('getDefault')
224-
->willReturn($this->website);
225-
$this->website->expects($this->once())
226-
->method('getId')
227-
->willReturn(1);
224+
->willReturn($websiteId);
225+
226+
if ($websiteId) {
227+
$this->websiteRepository->expects($this->never())
228+
->method('getDefault');
229+
} else {
230+
$this->websiteRepository->expects($this->once())
231+
->method('getDefault')
232+
->willReturn($this->website);
233+
$this->website->expects($this->once())
234+
->method('getId')
235+
->willReturn(1);
236+
}
228237
$this->selectionCollection->expects($this->once())
229238
->method('getIterator')
230239
->willReturn(new \ArrayIterator([]));
@@ -271,4 +280,12 @@ public function testGetPriceListWithSearchMin(): void
271280

272281
$this->model->getPriceList($this->product, true, false);
273282
}
283+
284+
public static function dataProvider()
285+
{
286+
return [
287+
'website provided' => [1],
288+
'website not provided' => [0]
289+
];
290+
}
274291
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogInventoryGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
11+
use Magento\Framework\GraphQl\Config\Element\Field;
12+
use Magento\Framework\GraphQl\Query\ResolverInterface;
13+
use Magento\CatalogInventoryGraphQl\Model\StockItemService;
14+
15+
/**
16+
* Resolver for ProductInterface max quantity
17+
* Returns the available stock max quantity
18+
*/
19+
class MaxSaleQtyResolver implements ResolverInterface
20+
{
21+
/**
22+
* @var StockItemService
23+
*/
24+
private $stockItemService;
25+
26+
/**
27+
* @param StockItemService $stockItemService
28+
*/
29+
public function __construct(
30+
StockItemService $stockItemService
31+
) {
32+
$this->stockItemService = $stockItemService;
33+
}
34+
35+
/**
36+
* @inheritdoc
37+
*/
38+
public function resolve(
39+
Field $field,
40+
$context,
41+
ResolveInfo $info,
42+
?array $value = null,
43+
?array $args = null
44+
) {
45+
$stockItem = $this->stockItemService->getStockItem($value['model']);
46+
return $stockItem?->getMaxSaleQty();
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogInventoryGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
11+
use Magento\Framework\GraphQl\Config\Element\Field;
12+
use Magento\Framework\GraphQl\Query\ResolverInterface;
13+
use Magento\CatalogInventoryGraphQl\Model\StockItemService;
14+
15+
/**
16+
* Resolver for ProductInterface min quantity
17+
* Returns the available stock min quantity
18+
*/
19+
class MinSaleQtyResolver implements ResolverInterface
20+
{
21+
/**
22+
* @var StockItemService
23+
*/
24+
private $stockItemService;
25+
26+
/**
27+
* @param StockItemService $stockItemService
28+
*/
29+
public function __construct(
30+
StockItemService $stockItemService
31+
) {
32+
$this->stockItemService = $stockItemService;
33+
}
34+
35+
/**
36+
* @inheritdoc
37+
*/
38+
public function resolve(
39+
Field $field,
40+
$context,
41+
ResolveInfo $info,
42+
?array $value = null,
43+
?array $args = null
44+
) {
45+
$stockItem = $this->stockItemService->getStockItem($value['model']);
46+
return $stockItem?->getMinSaleQty();
47+
}
48+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogInventoryGraphQl\Model;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Model\Product;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\CatalogInventory\Model\StockRegistry;
14+
use Magento\CatalogInventory\Model\Stock\Item;
15+
16+
/**
17+
* Service to provide stock item for given product
18+
*/
19+
class StockItemService
20+
{
21+
/**
22+
* Configurable product type code
23+
*/
24+
private const PRODUCT_TYPE_CONFIGURABLE = "configurable";
25+
26+
/**
27+
* @var ProductRepositoryInterface
28+
*/
29+
private $productRepositoryInterface;
30+
31+
/**
32+
* @var StockRegistry
33+
*/
34+
private $stockRegistry;
35+
36+
/**
37+
* @param ProductRepositoryInterface $productRepositoryInterface
38+
* @param StockRegistry $stockRegistry
39+
*/
40+
public function __construct(
41+
ProductRepositoryInterface $productRepositoryInterface,
42+
StockRegistry $stockRegistry
43+
) {
44+
$this->productRepositoryInterface = $productRepositoryInterface;
45+
$this->stockRegistry = $stockRegistry;
46+
}
47+
48+
/**
49+
* Returns stock item if the product is available
50+
*
51+
* @param Product|null $product
52+
* @return Item|null
53+
* @throws LocalizedException
54+
*/
55+
public function getStockItem(?Product $product): ?Item
56+
{
57+
if (!isset($product)) {
58+
throw new LocalizedException(__('"model" value should be specified'));
59+
}
60+
if ($product->getTypeId() === self::PRODUCT_TYPE_CONFIGURABLE) {
61+
$product = $this->productRepositoryInterface->get($product->getSku());
62+
}
63+
return $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId());
64+
}
65+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# Copyright © Magento, Inc. All rights reserved.
2-
# See COPYING.txt for license details.
1+
# Copyright 2018 Adobe
2+
# All Rights Reserved.
33

44
interface ProductInterface {
55
only_x_left_in_stock: Float @doc(description: "Remaining stock if it is below the value assigned to the Only X Left Threshold option in the Admin.") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\OnlyXLeftInStockResolver")
66
stock_status: ProductStockStatus @doc(description: "The stock status of the product.") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\StockStatusProvider")
77
quantity: Float @doc(description: "Amount of available stock") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\QuantityResolver")
8+
min_sale_qty: Float @doc(description: "Minimum Qty Allowed in Shopping Cart") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\MinSaleQtyResolver")
9+
max_sale_qty: Float @doc(description: "Maximum Qty Allowed in Shopping Cart") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\MaxSaleQtyResolver")
810
}
911

1012
enum ProductStockStatus @doc(description: "States whether a product stock status is in stock or out of stock.") {

app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageActionsSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="CmsNewPagePageActionsSection">
12-
<element name="savePage" type="button" selector="#save_and_close" timeout="60"/>
12+
<element name="savePage" type="button" selector="#save_and_close" timeout="160"/>
1313
<element name="reset" type="button" selector="#reset"/>
14-
<element name="saveAndContinueEdit" type="button" selector="#save-button" timeout="10"/>
14+
<element name="saveAndContinueEdit" type="button" selector="#save-button" timeout="120"/>
1515
<element name="saveAndDuplicate" type="button" selector="#save_and_duplicate" timeout="10"/>
1616
<element name="splitButtonMenu" type="button" selector="//ul[@data-ui-id='save-button-dropdown-menu']" timeout="10"/>
1717
<element name="expandSplitButton" type="button" selector="//button[@data-ui-id='save-button-dropdown']" timeout="10"/>

app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCheckCurrencyConverterApiConfigurationTest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -20,6 +20,10 @@
2020
<group value="currency"/>
2121
<!-- Remove this group when Subscription is finalized or Mocking is enabled -->
2222
<group value="pr_exclude" />
23+
<!-- added skip tag for test because of api key issue -->
24+
<skip>
25+
<issueId value="Issue with currency converter api key" />
26+
</skip>
2327
</annotations>
2428
<before>
2529
<!--Set currency configuration-->

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
use Magento\Customer\ViewModel\Customer\Data;
7-
use Magento\Framework\App\ObjectManager;
87
use Magento\Customer\ViewModel\CookieSettings;
98

10-
/** @var \Magento\Customer\Block\CustomerData $block */
9+
/**
10+
* @var \Magento\Customer\Block\CustomerData $block
11+
* @var \Magento\Framework\Escaper $escaper
12+
*/
1113

1214
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
1315
/** @var Auth $auth */
14-
$auth = $block->getAuth() ?? ObjectManager::getInstance()->get(Auth::class);
16+
$auth = $block->getAuth();
1517
/** @var JsonSerializer $jsonSerializer */
16-
$jsonSerializer = $block->getJsonSerializer() ??
17-
ObjectManager::getInstance()->get(JsonSerializer::class);
18+
$jsonSerializer = $block->getJsonSerializer();
1819
$customerDataUrl = $block->getCustomerDataUrl('customer/account/updateSession');
1920
$expirableSectionNames = $block->getExpirableSectionNames();
2021
/** @var CookieSettings $cookieSettings */
@@ -24,14 +25,14 @@ $cookieSettings = $block->getCookieSettings();
2425
{
2526
"*": {
2627
"Magento_Customer/js/customer-data": {
27-
"sectionLoadUrl": "<?= $block->escapeJs($block->getCustomerDataUrl('customer/section/load')) ?>",
28+
"sectionLoadUrl": "<?= $escaper->escapeJs($block->getCustomerDataUrl('customer/section/load')) ?>",
2829
"expirableSectionLifetime": <?= (int)$block->getExpirableSectionLifetime() ?>,
2930
"expirableSectionNames": <?= /* @noEscape */ $jsonSerializer->serialize(
3031
$expirableSectionNames
3132
) ?>,
32-
"cookieLifeTime": "<?= $block->escapeJs($block->getCookieLifeTime()) ?>",
33-
"cookieDomain": "<?= $block->escapeJs($cookieSettings->getCookieDomain()) ?>",
34-
"updateSessionUrl": "<?= $block->escapeJs($customerDataUrl) ?>",
33+
"cookieLifeTime": "<?= $escaper->escapeJs($block->getCookieLifeTime()) ?>",
34+
"cookieDomain": "<?= $escaper->escapeJs($cookieSettings->getCookieDomain()) ?>",
35+
"updateSessionUrl": "<?= $escaper->escapeJs($customerDataUrl) ?>",
3536
"isLoggedIn": "<?= /* @noEscape */ $auth->isLoggedIn() ?>"
3637
}
3738
}

0 commit comments

Comments
 (0)