Skip to content

Commit ff754e8

Browse files
ENGCOM-5092: GraphQl-535: provided catalog configs #650
- Merge Pull Request magento/graphql-ce#650 from magento/graphql-ce:graphQL-535-provide-catalog-cofigs-for-pwa - Merged commits: 1. 9d240e3 2. 8f36cf2 3. 9f2f5b6
2 parents beb058c + 9f2f5b6 commit ff754e8

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,19 @@
8080
</virtualType>
8181
<preference for="Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match"
8282
type="Magento\CatalogGraphQl\Model\Search\Adapter\Mysql\Query\Builder\Match" />
83+
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
84+
<arguments>
85+
<argument name="extendedConfigData" xsi:type="array">
86+
<item name="product_url_suffix" xsi:type="string">catalog/seo/product_url_suffix</item>
87+
<item name="category_url_suffix" xsi:type="string">catalog/seo/category_url_suffix</item>
88+
<item name="title_separator" xsi:type="string">catalog/seo/title_separator</item>
89+
<item name="list_mode" xsi:type="string">catalog/frontend/list_mode</item>
90+
<item name="grid_per_page_values" xsi:type="string">catalog/frontend/grid_per_page_values</item>
91+
<item name="list_per_page_values" xsi:type="string">catalog/frontend/list_per_page_values</item>
92+
<item name="grid_per_page" xsi:type="string">catalog/frontend/grid_per_page</item>
93+
<item name="list_per_page" xsi:type="string">catalog/frontend/list_per_page</item>
94+
<item name="catalog_default_sort_by" xsi:type="string">catalog/frontend/default_sort_by</item>
95+
</argument>
96+
</arguments>
97+
</type>
8398
</config>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,15 @@ type SortFields @doc(description: "SortFields contains a default value for sort
401401
default: String @doc(description: "Default value of sort fields")
402402
options: [SortField] @doc(description: "Available sort fields")
403403
}
404+
405+
type StoreConfig @doc(description: "The type contains information about a store config") {
406+
product_url_suffix : String @doc(description: "Product URL Suffix")
407+
category_url_suffix : String @doc(description: "Category URL Suffix")
408+
title_separator : String @doc(description: "Page Title Separator")
409+
list_mode : String @doc(description: "List Mode")
410+
grid_per_page_values : String @doc(description: "Products per Page on Grid Allowed Values")
411+
list_per_page_values : String @doc(description: "Products per Page on List Allowed Values")
412+
grid_per_page : Int @doc(description: "Products per Page on Grid Default Value")
413+
list_per_page : Int @doc(description: "Products per Page on List Default Value")
414+
catalog_default_sort_by : String @doc(description: "Default Sort By")
415+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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\GraphQl\Catalog;
9+
10+
use Magento\TestFramework\TestCase\GraphQlAbstract;
11+
12+
/**
13+
* Test the GraphQL endpoint's StoreConfigs query for Catalog Configs
14+
*/
15+
class StoreConfigTest extends GraphQlAbstract
16+
{
17+
protected function setUp()
18+
{
19+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/167');
20+
}
21+
22+
/**
23+
* @magentoApiDataFixture Magento/Store/_files/store.php
24+
*/
25+
public function testGetStoreConfig()
26+
{
27+
$query
28+
= <<<QUERY
29+
{
30+
storeConfig{
31+
product_url_suffix,
32+
category_url_suffix,
33+
title_separator,
34+
list_mode,
35+
grid_per_page_values,
36+
list_per_page_values,
37+
grid_per_page,
38+
list_per_page,
39+
catalog_default_sort_by
40+
}
41+
}
42+
QUERY;
43+
$response = $this->graphQlQuery($query);
44+
$this->assertArrayHasKey('storeConfig', $response);
45+
46+
//TODO: provide assertions after unmarking test as incomplete
47+
}
48+
}

0 commit comments

Comments
 (0)