Skip to content

Commit e48b046

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-1117
2 parents d632bc8 + 735a01b commit e48b046

File tree

19 files changed

+397
-62
lines changed

19 files changed

+397
-62
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@
4141
<element name="productNameByPosition" type="text" selector=".products-grid li:nth-of-type({{position}}) .product-item-name a" parameterized="true"/>
4242
<element name="sidebarAdditional" type="block" selector="#maincontent .sidebar.sidebar-additional"/>
4343
<element name="searchStore" type="input" selector="//div/input[@id='search']" />
44+
<element name="productAttributeName" type="button" selector="//div[@class='filter-options-title' and contains(text(),'{{var1}}')]" parameterized="true"/>
45+
<element name="productAttributeOptionValue" type="button" selector="//div[@id='narrow-by-list']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
4446
</section>
4547
</sections>

app/code/Magento/Cms/Block/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function _addBreadcrumbs(\Magento\Cms\Model\Page $page)
135135
'web/default/cms_no_route',
136136
ScopeInterface::SCOPE_STORE
137137
);
138-
$noRouteDelimiterPosition = strrpos($noRouteIdentifier, '|');
138+
$noRouteDelimiterPosition = $noRouteIdentifier === null ? false : strrpos($noRouteIdentifier, '|');
139139
if ($noRouteDelimiterPosition) {
140140
$noRouteIdentifier = substr($noRouteIdentifier, 0, $noRouteDelimiterPosition);
141141
}

app/code/Magento/Config/Model/Config/Structure/Element/Dependency/Field.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
*/
66
namespace Magento\Config\Model\Config\Structure\Element\Dependency;
77

8-
/**
9-
* @api
10-
* @since 100.0.2
11-
*/
12-
138
/**
149
* Class Field
1510
*
1611
* Fields are used to describe possible values for a type/interface.
12+
*
13+
* @api
14+
* @since 100.0.2
1715
*/
1816
class Field
1917
{

app/code/Magento/Customer/Test/Fixture/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Customer implements RevertibleDataFixtureInterface
2929
{
3030
private const DEFAULT_DATA = [
31-
'password' => null,
31+
'password' => 'password',
3232
CustomerInterface::ID => null,
3333
CustomerInterface::CONFIRMATION => null,
3434
CustomerInterface::CREATED_AT => null,

app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ private function categoryProductByCustomSortOrder(int $categoryId): array
211211
$searchCriteria = $this->searchResult->getSearchCriteria();
212212
$sortOrders = $searchCriteria->getSortOrders() ?? [];
213213
$sortOrders = array_merge(['is_salable' => \Magento\Framework\DB\Select::SQL_DESC], $sortOrders);
214-
215214
$connection = $this->collection->getConnection();
216215
$query = clone $connection->select()
217216
->reset(\Magento\Framework\DB\Select::ORDER)
@@ -231,6 +230,14 @@ private function categoryProductByCustomSortOrder(int $categoryId): array
231230
. ' AND cat_index.store_id = ' . $storeId,
232231
['cat_index.position']
233232
);
233+
234+
$productIds = [];
235+
foreach ($this->searchResult->getItems() as $item) {
236+
$productIds[] = $item->getId();
237+
}
238+
239+
$query->where('e.entity_id IN(?)', $productIds);
240+
234241
foreach ($sortOrders as $field => $dir) {
235242
if ($field === 'name') {
236243
$entityTypeId = $this->collection->getEntity()->getTypeId();
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StoreFrontSearchWithProductAttributeOptionValue">
12+
<annotations>
13+
<stories value="Store front search product when display out of stock products to yes"/>
14+
<title value="Catalog shown entire catalog items count if show_of_stock_option enabled"/>
15+
<description value="Catalog shown entire catalog items count if show_of_stock_option enabled"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-6395"/>
18+
<group value="catalog_search"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 1" stepKey="setOutOfStockToYes"/>
22+
<magentoCLI command="cache:clean config" stepKey="cacheClean"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
25+
<createData entity="_defaultCategory" stepKey="createCategory"/>
26+
<createData entity="SimpleProduct" stepKey="createProduct01">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
30+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
31+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
32+
<requiredEntity createDataKey="createConfigProductAttribute"/>
33+
</createData>
34+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
35+
<requiredEntity createDataKey="createConfigProductAttribute"/>
36+
</createData>
37+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
38+
<requiredEntity createDataKey="createConfigProductAttribute"/>
39+
</createData>
40+
41+
<createData entity="SimpleProduct" stepKey="createProduct02">
42+
<requiredEntity createDataKey="createCategory"/>
43+
</createData>
44+
45+
<createData entity="AssignProductToCategory" stepKey="assignTestCategoryToTestProduct">
46+
<requiredEntity createDataKey="createCategory"/>
47+
<requiredEntity createDataKey="createProduct01"/>
48+
<requiredEntity createDataKey="createProduct02"/>
49+
</createData>
50+
</before>
51+
<after>
52+
<magentoCLI command="config:set cataloginventory/options/show_out_of_stock 0" stepKey="setOutOfStockToNo"/>
53+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
54+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
55+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
56+
<deleteData createDataKey="createProduct01" stepKey="deleteProduct1"/>
57+
<deleteData createDataKey="createProduct02" stepKey="deleteProduct2"/>
58+
</after>
59+
60+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.custom_attributes[url_key]$$)}}" stepKey="goToStorefrontCreatedCategoryPage"/>
61+
<click selector="{{StorefrontCategoryMainSection.productAttributeName('attribute')}}" stepKey="selectProductAttribute"/>
62+
<wait time="2" stepKey="waitForLoad"/>
63+
<click selector="{{StorefrontCategoryMainSection.productAttributeOptionValue('option')}}" stepKey="selectProductAttributeOptionValue"/>
64+
</test>
65+
</tests>

app/code/Magento/Payment/Model/Method/Free.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
*/
2121
class Free extends \Magento\Payment\Model\Method\AbstractMethod
2222
{
23-
const PAYMENT_METHOD_FREE_CODE = 'free';
23+
public const PAYMENT_METHOD_FREE_CODE = 'free';
2424

2525
/**
2626
* XML Paths for configuration constants
2727
*/
28-
const XML_PATH_PAYMENT_FREE_ACTIVE = 'payment/free/active';
28+
public const XML_PATH_PAYMENT_FREE_ACTIVE = 'payment/free/active';
2929

30-
const XML_PATH_PAYMENT_FREE_ORDER_STATUS = 'payment/free/order_status';
30+
public const XML_PATH_PAYMENT_FREE_ORDER_STATUS = 'payment/free/order_status';
3131

32-
const XML_PATH_PAYMENT_FREE_PAYMENT_ACTION = 'payment/free/payment_action';
32+
public const XML_PATH_PAYMENT_FREE_PAYMENT_ACTION = 'payment/free/payment_action';
3333

3434
/**
3535
* Payment Method features
@@ -50,6 +50,11 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod
5050
*/
5151
protected $priceCurrency;
5252

53+
/**
54+
* @var bool
55+
*/
56+
protected $_isOffline = true;
57+
5358
/**
5459
* @param \Magento\Framework\Model\Context $context
5560
* @param \Magento\Framework\Registry $registry
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\PaymentGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\GraphQl\Query\ResolverInterface;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Payment\Helper\Data as PaymentData;
13+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
14+
use Magento\Framework\GraphQl\Config\Element\Field;
15+
16+
/**
17+
* Checks if payment method is deferred (online)
18+
*/
19+
class IsDeferred implements ResolverInterface
20+
{
21+
/**
22+
* @var PaymentData
23+
*/
24+
private $paymentData;
25+
26+
/**
27+
* @var array
28+
*/
29+
private $overrides;
30+
31+
/**
32+
* IsDeferred constructor.
33+
*
34+
* @param PaymentData $paymentData
35+
* @param array $overrides
36+
*/
37+
public function __construct(
38+
PaymentData $paymentData,
39+
array $overrides = []
40+
) {
41+
$this->paymentData = $paymentData;
42+
$this->overrides = $overrides;
43+
}
44+
45+
/**
46+
* @inheritdoc
47+
*/
48+
public function resolve(
49+
Field $field,
50+
$context,
51+
ResolveInfo $info,
52+
array $value = null,
53+
array $args = null
54+
) {
55+
if (!$value['code']) {
56+
throw new LocalizedException(__('"code" value should be specified'));
57+
}
58+
return $this->isDeferredPaymentMethod($value['code']);
59+
}
60+
61+
/**
62+
* Identifies whether the payment method is deferred
63+
*
64+
* @param string $code
65+
*
66+
* @return bool
67+
*/
68+
private function isDeferredPaymentMethod(string $code): bool
69+
{
70+
if (isset($this->overrides['deferred']) &&
71+
is_array($this->overrides['deferred']) &&
72+
in_array($code, $this->overrides['deferred'])
73+
) {
74+
return true;
75+
}
76+
if (isset($this->overrides['undeferred']) &&
77+
is_array($this->overrides['undeferred']) &&
78+
in_array($code, $this->overrides['undeferred'])
79+
) {
80+
return false;
81+
}
82+
return !$this->paymentData->getMethodInstance($code)->isOffline();
83+
}
84+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ type StoreConfig {
1919
check_money_order_max_order_total: String @doc(description: "The maximum order amount required to qualify for the Check/Money Order payment method.")
2020
check_money_order_sort_order: Int @doc(description: "A number indicating the position of the Check/Money Order payment method in the list of available payment methods during checkout.")
2121
}
22+
23+
type AvailablePaymentMethod @doc(description: "Describes a payment method that the shopper can use to pay for the order.") {
24+
is_deferred: Boolean! @doc(description: "If the payment method is an online integration") @resolver(class: "\\Magento\\PaymentGraphQl\\Model\\Resolver\\IsDeferred")
25+
}

app/code/Magento/QuoteGraphQl/Model/Resolver/AvailablePaymentMethods.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ public function __construct(
5050
/**
5151
* @inheritdoc
5252
*/
53-
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
54-
{
53+
public function resolve(
54+
Field $field,
55+
$context,
56+
ResolveInfo $info,
57+
array $value = null,
58+
array $args = null
59+
) {
5560
if (!isset($value['model'])) {
5661
throw new LocalizedException(__('"model" value should be specified'));
5762
}
@@ -79,18 +84,19 @@ private function getPaymentMethodsData(CartInterface $cart): array
7984
/**
8085
* Checking payment method and shipping method for zero price product
8186
*/
82-
if ((int)$grandTotal === 0 && $carrierCode === self::FREE_SHIPPING_METHOD
83-
&& $paymentMethod->getCode() === self::FREE_PAYMENT_METHOD_CODE) {
87+
if ((int)$grandTotal === 0 && $carrierCode === self::FREE_SHIPPING_METHOD &&
88+
$paymentMethod->getCode() === self::FREE_PAYMENT_METHOD_CODE
89+
) {
8490
return [
8591
[
8692
'title' => $paymentMethod->getTitle(),
87-
'code' => $paymentMethod->getCode(),
93+
'code' => $paymentMethod->getCode()
8894
]
8995
];
9096
} elseif ((int)$grandTotal >= 0) {
9197
$paymentMethodsData[] = [
9298
'title' => $paymentMethod->getTitle(),
93-
'code' => $paymentMethod->getCode(),
99+
'code' => $paymentMethod->getCode()
94100
];
95101
}
96102
}

0 commit comments

Comments
 (0)