From cb7e3f6007c2df97bfb1c7658df9a4ff45f2edd6 Mon Sep 17 00:00:00 2001 From: Wouter Steenmeijer Date: Tue, 19 Nov 2024 10:04:11 +0100 Subject: [PATCH 1/5] Change Connection Class to Resource class to support Table prefix --- .../Model/Indexer/Category/Fulltext/Datasource/Url.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-autocomplete/Model/Indexer/Category/Fulltext/Datasource/Url.php b/src/module-elasticsuite-autocomplete/Model/Indexer/Category/Fulltext/Datasource/Url.php index fcb42b7..e85f23b 100644 --- a/src/module-elasticsuite-autocomplete/Model/Indexer/Category/Fulltext/Datasource/Url.php +++ b/src/module-elasticsuite-autocomplete/Model/Indexer/Category/Fulltext/Datasource/Url.php @@ -65,7 +65,7 @@ protected function getRequestPathData(int $storeId): array { $connection = $this->resource->getConnection(); $select = $connection->select()->from( - ['url_rewrite' => $connection->getTableName('url_rewrite')], + ['url_rewrite' => $this->resource->getTableName('url_rewrite')], ['request_path', 'entity_id'] )->where('entity_type = ?', 'category') ->where('store_id = ?', $storeId) From b1b4d75e98e17765418f55a2ea94799c9d3c3c4d Mon Sep 17 00:00:00 2001 From: Wouter Steenmeijer Date: Tue, 19 Nov 2024 10:05:02 +0100 Subject: [PATCH 2/5] Change Connection Class to Resource class to support Table prefix --- .../Product/Fulltext/Datasource/AdditionalAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/AdditionalAttributes.php b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/AdditionalAttributes.php index ae3c8c8..01d6b00 100644 --- a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/AdditionalAttributes.php +++ b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/AdditionalAttributes.php @@ -137,7 +137,7 @@ protected function getValueFromAttributes(int $storeId, AttributeInterface $attr } $connection = $this->resource->getConnection(); - $tableName = $connection->getTableName('catalog_product_entity_' . $attribute->getBackendType()); + $tableName = $this->resource->getTableName('catalog_product_entity_' . $attribute->getBackendType()); $select = $connection->select()->from( ['cpe_default' => $tableName], [] From d7cfa6ef4762e09193dd1daae812ba9c4cdd0a72 Mon Sep 17 00:00:00 2001 From: Wouter Steenmeijer Date: Tue, 19 Nov 2024 10:06:12 +0100 Subject: [PATCH 3/5] Change Connection Class to Resource class to support Table prefix --- .../Product/Fulltext/Datasource/ConfigurablePrice.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/ConfigurablePrice.php b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/ConfigurablePrice.php index c75d515..adb7d92 100644 --- a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/ConfigurablePrice.php +++ b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/ConfigurablePrice.php @@ -132,18 +132,18 @@ protected function getMinFinalPrice(array $parentIds, int $websiteId, bool $inSt { $connection = $this->resource->getConnection(); $select = $connection->select()->from( - ['parent' => $connection->getTableName('catalog_product_entity')], + ['parent' => $this->resource->getTableName('catalog_product_entity')], [] )->join( - ['link' => $connection->getTableName('catalog_product_relation')], + ['link' => $this->resource->getTableName('catalog_product_relation')], 'link.parent_id = parent.entity_id', [] )->join( - ['t' => $connection->getTableName($this->getPriceIndexDimensionsTables($websiteId))], + ['t' => $this->resource->getTableName($this->getPriceIndexDimensionsTables($websiteId))], 't.entity_id = link.child_id ', [] )->join( - ['csi' => $connection->getTableName('cataloginventory_stock_item')], + ['csi' => $this->resource->getTableName('cataloginventory_stock_item')], 'csi.product_id = link.child_id AND csi.is_in_stock=' . $inStock ? '1' : '0', [] )->columns([ From d72e8ffa48cd0552fb40e176c01f7814a23dc0d7 Mon Sep 17 00:00:00 2001 From: Wouter Steenmeijer Date: Tue, 19 Nov 2024 10:06:50 +0100 Subject: [PATCH 4/5] Change Connection Class to Resource class to support Table prefix --- .../Model/Indexer/Product/Fulltext/Datasource/Url.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/Url.php b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/Url.php index bee7b15..f3be326 100644 --- a/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/Url.php +++ b/src/module-elasticsuite-autocomplete/Model/Indexer/Product/Fulltext/Datasource/Url.php @@ -64,7 +64,7 @@ protected function getRequestPathData(int $storeId, array $productId): array { $connection = $this->resource->getConnection(); $select = $connection->select()->from( - ['url_rewrite' => $connection->getTableName('url_rewrite')], + ['url_rewrite' => $this->resource->getTableName('url_rewrite')], ['request_path', 'entity_id'] )->where('entity_type = ?', 'product') ->where('entity_id IN (?)', $productId) From 3190722816eee506b7c5004692129b0eac99067e Mon Sep 17 00:00:00 2001 From: Wouter Steenmeijer Date: Fri, 29 Nov 2024 10:06:05 +0100 Subject: [PATCH 5/5] Update search.php --- src/pub/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pub/search.php b/src/pub/search.php index 6026deb..3541ac5 100644 --- a/src/pub/search.php +++ b/src/pub/search.php @@ -1,4 +1,5 @@ getObjectManager(); $obj->get('Magento\Framework\App\State')->setAreaCode('frontend');