Skip to content

Commit e95f66e

Browse files
authored
MCLOUD-6923: Layered navigation filter is present only when product i… (#15)
1 parent ee75919 commit e95f66e

4 files changed

+65
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ before_install:
7474
- if [ -n "${COMPOSER_VERSION}" ]; then travis_retry composer self-update ${COMPOSER_VERSION}; fi;
7575

7676
install:
77+
- phpenv config-add travis.php.ini
7778
- composer config http-basic.repo.magento.com ${REPO_USERNAME_CE} ${REPO_PASSWORD_CE}
7879
- composer config github-oauth.github.com ${GITHUB_TOKEN}
7980
- if [ -n "${MCD_VERSION}" ] && [ $TRAVIS_PHP_VERSION != "7.0" ]; then composer config repositories.mcd git [email protected]:magento/magento-cloud-docker.git && composer require "magento/magento-cloud-docker:${MCD_VERSION}" --no-update; fi;

patches.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@
340340
"4.1.0": "BUNDLE-2683__braintree_settlement_report_fix__4.1.0.patch"
341341
}
342342
},
343+
"magento/magento2-b2b-base": {
344+
"Layered navigation filter is present only when product is present on the listing page with enabled Shared catalog": {
345+
">=1.1.5 <1.3.1": "MCLOUD-6923__layered_navigation_filter_is_present_only_when_product_is_present_on_the_listing_page_with_enabled_shared_catalog__2.3.5.patch"
346+
}
347+
},
343348
"magento/magento2-ee-base": {
344349
"Fix pagebuilder module": {
345350
"2.3.1": "PB-319__fix_pagebuilder_module__2.3.1.patch",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff -Nuar a/vendor/magento/module-shared-catalog/Model/SearchAdapter/Aggregation/Builder/DataProvider.php b/vendor/magento/module-shared-catalog/Model/SearchAdapter/Aggregation/Builder/DataProvider.php
2+
--- a/vendor/magento/module-shared-catalog/Model/SearchAdapter/Aggregation/Builder/DataProvider.php
3+
+++ b/vendor/magento/module-shared-catalog/Model/SearchAdapter/Aggregation/Builder/DataProvider.php
4+
@@ -103,18 +103,16 @@ public function __construct(
5+
*
6+
* @param BucketInterface $bucket
7+
* @param array $dimensions
8+
- * @param array $documentIds
9+
* @return array
10+
* @throws \Magento\Framework\Exception\LocalizedException
11+
* @throws \Zend_Db_Statement_Exception
12+
*/
13+
public function getAggregation(
14+
BucketInterface $bucket,
15+
- array $dimensions,
16+
- array $documentIds
17+
+ array $dimensions
18+
) {
19+
$result = [];
20+
- $select = $this->getSelect($bucket, $dimensions, $documentIds);
21+
+ $select = $this->getSelect($bucket, $dimensions);
22+
$query = $this->connection->query($select);
23+
24+
while ($row = $query->fetch()) {
25+
@@ -134,11 +132,10 @@ public function getAggregation(
26+
*
27+
* @param BucketInterface $bucket
28+
* @param array $dimensions
29+
- * @param array $documentIds
30+
* @return Select
31+
* @throws \Magento\Framework\Exception\LocalizedException
32+
*/
33+
- private function getSelect(BucketInterface $bucket, array $dimensions, array $documentIds)
34+
+ private function getSelect(BucketInterface $bucket, array $dimensions)
35+
{
36+
$attribute = $this->eavConfig->getAttribute(Product::ENTITY, $bucket->getField());
37+
$currentScope = $this->scopeResolver->getScope($dimensions['scope']->getValue());
38+
@@ -161,7 +158,6 @@ private function getSelect(BucketInterface $bucket, array $dimensions, array $do
39+
'source_entity.sku = shared_catalog_item.sku',
40+
[]
41+
)
42+
- ->where('eav.entity_id IN (?)', $documentIds)
43+
->where('eav.attribute_id = ?', $attribute->getId())
44+
->where('eav.store_id = ? ', $currentScope->getId())
45+
->where('source_entity.type_id <> ?', 'configurable')
46+
diff -Nuar a/vendor/magento/module-shared-catalog/Plugin/Elasticsearch/SearchAdapter/Aggregation/Builder/UpdateTermBucketBuilderPlugin.php b/vendor/magento/module-shared-catalog/Plugin/Elasticsearch/SearchAdapter/Aggregation/Builder/UpdateTermBucketBuilderPlugin.php
47+
--- a/vendor/magento/module-shared-catalog/Plugin/Elasticsearch/SearchAdapter/Aggregation/Builder/UpdateTermBucketBuilderPlugin.php
48+
+++ b/vendor/magento/module-shared-catalog/Plugin/Elasticsearch/SearchAdapter/Aggregation/Builder/UpdateTermBucketBuilderPlugin.php
49+
@@ -65,8 +65,7 @@ public function afterBuild(
50+
$shouldAggregate = ($bucket->getField() !== 'category_ids');
51+
52+
if ($sharedCatalogIsEnabled && $shouldAggregate) {
53+
- $documentIds = array_column($queryResult['hits']['hits'], '_id');
54+
- $values = $this->dataProvider->getAggregation($bucket, $dimensions, $documentIds);
55+
+ $values = $this->dataProvider->getAggregation($bucket, $dimensions);
56+
}
57+
58+
return $values;

travis.php.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
memory_limit = 4G

0 commit comments

Comments
 (0)