Skip to content

Commit 866e389

Browse files
authored
Merge branch '2.4-develop' into MCLOUD-11109
2 parents 48e993b + 59b2921 commit 866e389

File tree

14 files changed

+264
-47
lines changed

14 files changed

+264
-47
lines changed

app/code/Magento/CustomerGraphQl/Model/Customer/GetAttributesForm.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ public function execute(string $formCode): ?array
4242
{
4343
$attributes = [];
4444
foreach ($this->entity->getAttributes($formCode) as $attribute) {
45-
// region_id and country_id returns large datasets that is also not related between each other and
46-
// not filterable. DirectoryGraphQl contains queries that allow to retrieve this information in a
47-
// meaningful way
48-
if ($attribute->getAttributeCode() === 'region_id' || $attribute->getAttributeCode() === 'country_id') {
49-
continue;
50-
}
5145
$attributes[] = ['entity_type' => $this->type, 'attribute_code' => $attribute->getAttributeCode()];
5246
}
5347
return $attributes;

app/code/Magento/EavGraphQl/Model/Output/GetAttributeData.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?php
2-
32
/**
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
7-
86
declare(strict_types=1);
97

108
namespace Magento\EavGraphQl\Model\Output;
@@ -24,12 +22,19 @@ class GetAttributeData implements GetAttributeDataInterface
2422
*/
2523
private EnumLookup $enumLookup;
2624

25+
/**
26+
* @var array
27+
*/
28+
private array $skipOptionsForAttributeCodes;
29+
2730
/**
2831
* @param EnumLookup $enumLookup
32+
* @param array $skipOptionsForAttributeCodes
2933
*/
30-
public function __construct(EnumLookup $enumLookup)
34+
public function __construct(EnumLookup $enumLookup, array $skipOptionsForAttributeCodes = [])
3135
{
3236
$this->enumLookup = $enumLookup;
37+
$this->skipOptionsForAttributeCodes = $skipOptionsForAttributeCodes;
3338
}
3439

3540
/**
@@ -91,7 +96,7 @@ private function getFrontendInput(AttributeInterface $attribute): string
9196
*/
9297
private function getOptions(AttributeInterface $attribute): array
9398
{
94-
if (!$attribute->getOptions()) {
99+
if (!$attribute->getOptions() || $this->skipOptions($attribute)) {
95100
return [];
96101
}
97102
return array_filter(
@@ -133,4 +138,18 @@ private function isDefault(mixed $value, mixed $defaultValue): bool
133138

134139
return in_array($value, explode(',', $defaultValue));
135140
}
141+
142+
/**
143+
* Skip attributes options for region_id and country_id
144+
*
145+
* Attributes region_id and country_id returns large datasets that is also not related between each other and
146+
* not filterable. DirectoryGraphQl contains queries that allow to retrieve this information in a meaningful way
147+
*
148+
* @param AttributeInterface $attribute
149+
* @return bool
150+
*/
151+
private function skipOptions(AttributeInterface $attribute): bool
152+
{
153+
return in_array($attribute->getAttributeCode(), $this->skipOptionsForAttributeCodes);
154+
}
136155
}

app/code/Magento/EavGraphQl/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@
99
<type name="Magento\Eav\Model\Entity\Attribute">
1010
<plugin name="entityAttributeChangePlugin" type="Magento\EavGraphQl\Plugin\Eav\AttributePlugin" />
1111
</type>
12+
<type name="Magento\EavGraphQl\Model\Output\GetAttributeData">
13+
<arguments>
14+
<argument name="skipOptionsForAttributeCodes" xsi:type="array">
15+
<item name="region_id" xsi:type="string">region_id</item>
16+
<item name="country_id" xsi:type="string">country_id</item>
17+
</argument>
18+
</arguments>
19+
</type>
1220
</config>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Query {
1111
customAttributeMetadataV2(attributes: [AttributeInput!]): AttributesMetadataOutput! @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesMetadata") @doc(description: "Retrieve EAV attributes metadata.") @cache(cacheIdentity: "Magento\\EavGraphQl\\Model\\Resolver\\Cache\\CustomAttributeMetadataV2Identity")
1212
attributesForm(formCode: String! @doc(description: "Form code.")): AttributesFormOutput!
1313
@resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesForm")
14-
@doc(description: "Retrieve EAV attributes associated to a frontend form. For region_id and country_id attributes information use DirectoryGraphQl module.")
14+
@doc(description: "Retrieve EAV attributes associated to a frontend form. Use countries query provided by DirectoryGraphQl module to retrieve region_id and country_id attribute options.")
1515
@cache(cacheIdentity: "Magento\\Eav\\Model\\Cache\\AttributesFormIdentity")
1616
attributesList(
1717
entityType: AttributeEntityTypeEnum! @doc(description: "Entity type.")

app/code/Magento/QuoteGraphQl/etc/graphql/di.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,13 @@
6060
</argument>
6161
</arguments>
6262
</type>
63+
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
64+
<arguments>
65+
<argument name="extendedConfigData" xsi:type="array">
66+
<item name="is_guest_checkout_enabled" xsi:type="string">checkout/options/guest_checkout</item>
67+
<item name="is_one_page_checkout_enabled" xsi:type="string">checkout/options/onepage_checkout_enabled</item>
68+
<item name="max_items_in_order_summary" xsi:type="string">checkout/options/max_items_display_count</item>
69+
</argument>
70+
</arguments>
71+
</type>
6372
</config>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,3 +442,8 @@ enum CartUserInputErrorType {
442442
UNDEFINED
443443
}
444444

445+
type StoreConfig {
446+
is_guest_checkout_enabled: Boolean @doc(description: "Extended Config Data - checkout/options/guest_checkout")
447+
is_one_page_checkout_enabled: Boolean @doc(description: "Extended Config Data - checkout/options/onepage_checkout_enabled")
448+
max_items_in_order_summary: Int @doc(description: "Extended Config Data - checkout/options/max_items_display_count")
449+
}

app/code/Magento/StoreGraphQl/etc/graphql/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<arguments>
2828
<argument name="extendedConfigData" xsi:type="array">
2929
<item name="use_store_in_url" xsi:type="string">web/url/use_store</item>
30+
<item name="default_country" xsi:type="string">general/country/default</item>
31+
<item name="countries_with_required_region" xsi:type="string">general/region/state_required</item>
32+
<item name="display_state_if_optional" xsi:type="string">general/region/display_all</item>
33+
<item name="optional_zip_countries" xsi:type="string">general/country/optional_zip_countries</item>
3034
</argument>
3135
</arguments>
3236
</type>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ type StoreConfig @doc(description: "Contains information about a store's configu
4343
secure_base_static_url : String @doc(description: "The secure fully-qualified URL that specifies the location of static view files.")
4444
secure_base_media_url : String @doc(description: "The secure fully-qualified URL that specifies the location of media files.")
4545
use_store_in_url: Boolean @doc(description: "Indicates whether the store code should be used in the URL.")
46+
default_country: String @doc(description: "Extended Config Data - general/country/default")
47+
countries_with_required_region: String @doc(description: "Extended Config Data - general/region/state_required")
48+
optional_zip_countries: String @doc(description: "Extended Config Data - general/country/optional_zip_countries")
49+
display_state_if_optional: Boolean @doc(description: "Extended Config Data - general/region/display_all")
4650
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ************************************************************************
17+
*/
18+
-->
19+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
20+
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
21+
<arguments>
22+
<argument name="extendedConfigData" xsi:type="array">
23+
<item name="shopping_cart_display_price" xsi:type="string">tax/cart_display/price</item>
24+
<item name="shopping_cart_display_shipping" xsi:type="string">tax/cart_display/shipping</item>
25+
<item name="shopping_cart_display_subtotal" xsi:type="string">tax/cart_display/subtotal</item>
26+
<item name="shopping_cart_display_grand_total" xsi:type="string">tax/cart_display/grandtotal</item>
27+
<item name="shopping_cart_display_full_summary" xsi:type="string">tax/cart_display/full_summary</item>
28+
<item name="shopping_cart_display_zero_tax" xsi:type="string">tax/cart_display/zero_tax</item>
29+
</argument>
30+
</arguments>
31+
</type>
32+
</config>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@
44
enum PriceAdjustmentCodesEnum {
55
TAX @deprecated(reason: "`PriceAdjustmentCodesEnum` is deprecated. Tax is included or excluded in the price. Tax is not shown separately in Catalog.")
66
}
7+
8+
type StoreConfig {
9+
shopping_cart_display_price: Int @doc(description: "Extended Config Data - tax/cart_display/price")
10+
shopping_cart_display_shipping: Int @doc(description: "Extended Config Data - tax/cart_display/shipping")
11+
shopping_cart_display_subtotal: Int @doc(description: "Extended Config Data - tax/cart_display/subtotal")
12+
shopping_cart_display_grand_total: Boolean @doc(description: "Extended Config Data - tax/cart_display/grandtotal")
13+
shopping_cart_display_full_summary: Boolean @doc(description: "Extended Config Data - tax/cart_display/full_summary")
14+
shopping_cart_display_zero_tax: Boolean @doc(description: "Extended Config Data - tax/cart_display/zero_tax")
15+
}

0 commit comments

Comments
 (0)