Skip to content

Commit 02c8ccd

Browse files
committed
updated graphql
1 parent 939a42d commit 02c8ccd

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

Model/Resolver/Products/DataProvider/Sellers.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ public function getListSellers
168168
$args['seller_id'] = $val->getData('seller_id');
169169
$sellerRates = $this->sellerFrontendRepository->getSellersRating($data['seller_id']);
170170
$data['seller_rates'] = $sellerRates;
171+
$data['group_id'] = $val->getGroupId();
172+
$data['group'] = $val->getSellerGroup();
171173
$data['products'] = $this->getResult( $args, $info, $context);
172174
$items[] = $data;
173175
}

Model/Resolver/Sellers.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,35 @@ public function resolve(
9898
throw new GraphQlInputException(__('pageSize value must be greater than 0.'));
9999
}
100100
$store = $context->getExtensionAttributes()->getStore();
101-
$args[Filter::ARGUMENT_NAME] = $this->formatMatchFilters($args['filters'], $store);
101+
$args[Filter::ARGUMENT_NAME] = $this->formatMatchFilters($args['filter'], $store);
102102
$searchCriteria = $this->searchCriteriaBuilder->build('lof_marketplace_seller', $args);
103103
$searchCriteria->setCurrentPage($args['currentPage']);
104104
$searchCriteria->setPageSize($args['pageSize']);
105105

106-
$searchResult = $this->_sellerRepository->getList($searchCriteria);
107-
106+
$searchResult = $this->sellers->getListSellers($searchCriteria, $args, $info, $context);
107+
$totalPages = $args['pageSize'] ? ((int)ceil($searchResult->getTotalCount() / $args['pageSize'])) : 0;
108+
$resultItems = $searchResult->getItems();
109+
// $items = [];
110+
// if($resultItems){
111+
// foreach($resultItems as $_item){
112+
// $items[] = $_item->__toArray();
113+
// }
114+
// }
108115
return [
109116
'total_count' => $searchResult->getTotalCount(),
110-
'items' => $searchResult->getItems()
117+
'items' => $resultItems,
118+
'page_info' => [
119+
'page_size' => $args['pageSize'],
120+
'current_page' => $args['currentPage'],
121+
'total_pages' => $totalPages
122+
]
111123
];
112124
}
113125

114126
/**
115-
* Format match filters to behave like fuzzy match
127+
* Format match filter to behave like fuzzy match
116128
*
117-
* @param array $filters
129+
* @param array $filter
118130
* @param StoreInterface $store
119131
* @return array
120132
* @throws InputException

etc/graphql/di.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
<item name="lofmarketplace_list_meta_description" xsi:type="string">lofmarketplace/seller_list_page/meta_description</item>
2121
<item name="lofmarketplace_list_meta_keywords" xsi:type="string">lofmarketplace/seller_list_page/meta_keywords</item>
2222
<item name="lofmarketplace_group_show_seller_name" xsi:type="string">lofmarketplace/group_page/show_seller_name</item>
23-
<item name="lofmarketplace_group_item_per_page" xsi:type="string">lofmarketplace/group_page/item_per_page</item>
23+
<item name="lofmarketplace_group_seller_enable" xsi:type="string">lofmarketplace/group_seller/enable_group_seller</item>
24+
<item name="lofmarketplace_group_seller_available" xsi:type="string">lofmarketplace/group_seller/group_seller</item>
25+
<item name="lofmarketplace_available_countries_enable" xsi:type="string">lofmarketplace/available_countries/enable_available_countries</item>
26+
<item name="lofmarketplace_available_countries" xsi:type="string">lofmarketplace/available_countries/available_countries</item>
2427
</argument>
2528
</arguments>
2629
</type>

etc/schema.graphqls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ type StoreConfig {
4141
lofmarketplace_list_meta_keywords : String @doc(description: "Query by lofmarketplace_list_meta_keywords.")
4242
lofmarketplace_group_show_seller_name : String @doc(description: "Query by lofmarketplace_group_show_seller_name.")
4343
lofmarketplace_group_item_per_page : String @doc(description: "Query by lofmarketplace_group_item_per_page.")
44+
lofmarketplace_group_seller_enable : String @doc(description: "Query by lofmarketplace_group_seller_enable.")
45+
lofmarketplace_group_seller_available : String @doc(description: "Query by lofmarketplace_group_seller_available.")
46+
lofmarketplace_available_countries_enable : String @doc(description: "Query by lofmarketplace_available_countries_enable.")
47+
lofmarketplace_available_countries : String @doc(description: "Query by lofmarketplace_available_countries.")
4448
}
4549

4650
type Query {
@@ -120,6 +124,7 @@ type Seller {
120124
city: String @doc(description: "City")
121125
region: String @doc(description: "Region")
122126
group: String @doc(description: "Group")
127+
group_id: Int @doc(description: "Group")
123128
url: String @doc(description: "Shop Url")
124129
customer_id: Int @doc(description: "Customer Id")
125130
email: String @doc(description: "Email")

0 commit comments

Comments
 (0)