Skip to content

Commit 09e1ecf

Browse files
committed
Merge remote-tracking branch 'hb/MAGETWO-89292-SDL' into MAGETWO-87654-Support-layered-navigation-in-one-query
2 parents 84e7b32 + 51c6bfe commit 09e1ecf

File tree

200 files changed

+1325
-986
lines changed

Some content is hidden

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

200 files changed

+1325
-986
lines changed

app/code/Magento/BundleGraphQl/Model/BundleProductTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\BundleGraphQl\Model;
99

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -115,47 +115,6 @@ public function execute()
115115
return $this;
116116
}
117117

118-
/**
119-
* Return select for remove unnecessary data
120-
*
121-
* @return \Magento\Framework\DB\Select
122-
*
123-
* @deprecated Not used anymore.
124-
* @see clearCurrentTable()
125-
*/
126-
protected function getSelectUnnecessaryData()
127-
{
128-
return $this->connection->select()->from(
129-
$this->getMainTable(),
130-
[]
131-
)->joinLeft(
132-
['t' => $this->getMainTable()],
133-
$this->getMainTable() .
134-
'.category_id = t.category_id AND ' .
135-
$this->getMainTable() .
136-
'.store_id = t.store_id AND ' .
137-
$this->getMainTable() .
138-
'.product_id = t.product_id',
139-
[]
140-
)->where(
141-
't.category_id IS NULL'
142-
);
143-
}
144-
145-
/**
146-
* Remove unnecessary data
147-
*
148-
* @return void
149-
*
150-
* @deprecated Not used anymore.
151-
* @see clearCurrentTable()
152-
*/
153-
protected function removeUnnecessaryData()
154-
{
155-
//Called for backward compatibility.
156-
$this->getSelectUnnecessaryData();
157-
}
158-
159118
/**
160119
* Publish data from tmp to index
161120
*
@@ -254,8 +213,6 @@ private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSe
254213
)
255214
);
256215
$this->publishData();
257-
//Called for backward compatibility.
258-
$this->removeUnnecessaryData();
259216
}
260217
}
261218
}

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,10 @@
4040
</div>
4141
</div>
4242
<?php endif; ?>
43-
<?php if ($block->isRedirectToCartEnabled()) : ?>
44-
<script type="text/x-magento-init">
45-
{
46-
"#product_addtocart_form": {
47-
"Magento_Catalog/product/view/validation": {
48-
"radioCheckboxClosest": ".nested"
49-
}
50-
}
51-
}
52-
</script>
53-
<?php else : ?>
5443
<script type="text/x-magento-init">
5544
{
5645
"#product_addtocart_form": {
5746
"Magento_Catalog/js/validate-product": {}
5847
}
5948
}
6049
</script>
61-
<?php endif; ?>

app/code/Magento/CatalogGraphQl/Model/CatalogProductTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model;
99

app/code/Magento/CatalogGraphQl/Model/CustomizableOptionTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model;
99

app/code/Magento/CatalogGraphQl/Model/ProductInterfaceTypeResolverComposite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model;
99

app/code/Magento/CatalogGraphQl/Model/ProductLinkTypeResolverComposite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model;
99

app/code/Magento/CatalogGraphQl/Model/ProductLinksTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model;
99

app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types = 1);
6+
declare(strict_types=1);
77

88
namespace Magento\CatalogGraphQl\Model\Resolver;
99

@@ -13,6 +13,7 @@
1313
use Magento\Framework\GraphQl\Config\Element\Field;
1414
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1515
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\Builder;
16+
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\SearchFilter;
1617
use Magento\Framework\GraphQl\Query\Resolver\Value;
1718
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
1819
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -38,6 +39,11 @@ class Products implements ResolverInterface
3839
*/
3940
private $filterQuery;
4041

42+
/**
43+
* @var SearchFilter
44+
*/
45+
private $searchFilter;
46+
4147
/**
4248
* @var ValueFactory
4349
*/
@@ -58,12 +64,14 @@ public function __construct(
5864
Builder $searchCriteriaBuilder,
5965
Search $searchQuery,
6066
Filter $filterQuery,
67+
SearchFilter $searchFilter,
6168
ValueFactory $valueFactory,
6269
\Magento\CatalogGraphQl\Model\Resolver\Layer\DataProvider\Filters $filtersDataProvider
6370
) {
6471
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
6572
$this->searchQuery = $searchQuery;
6673
$this->filterQuery = $filterQuery;
74+
$this->searchFilter = $searchFilter;
6775
$this->valueFactory = $valueFactory;
6876
$this->filtersDataProvider = $filtersDataProvider;
6977
}
@@ -78,13 +86,16 @@ public function resolve(
7886
array $value = null,
7987
array $args = null
8088
) : Value {
81-
$searchCriteria = $this->searchCriteriaBuilder->build($args);
89+
$searchCriteria = $this->searchCriteriaBuilder->build($field->getName(), $args);
90+
$searchCriteria->setCurrentPage($args['currentPage']);
91+
$searchCriteria->setPageSize($args['pageSize']);
8292
if (!isset($args['search']) && !isset($args['filter'])) {
8393
throw new GraphQlInputException(
8494
__("'search' or 'filter' input argument is required.")
8595
);
8696
} elseif (isset($args['search'])) {
8797
$layerType = Resolver::CATALOG_LAYER_SEARCH;
98+
$this->searchFilter->add($args['search'], $searchCriteria);
8899
$searchResult = $this->searchQuery->getResult($searchCriteria, $info);
89100
} else {
90101
$layerType = Resolver::CATALOG_LAYER_CATEGORY;

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Deferred/Product.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ private function fetch() : array
127127
}
128128

129129
$this->searchCriteriaBuilder->addFilter(ProductInterface::SKU, $this->productSkus, 'in');
130-
$result = $this->productDataProvider->getList($this->searchCriteriaBuilder->create(), $this->attributeCodes);
130+
$result = $this->productDataProvider->getList(
131+
$this->searchCriteriaBuilder->create(),
132+
$this->attributeCodes,
133+
false,
134+
true
135+
);
131136

132137
/** @var \Magento\Catalog\Model\Product $product */
133138
foreach ($result->getItems() as $product) {

0 commit comments

Comments
 (0)