From 313b04b0a29eb876df0870928436cb6037b6bdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Tue, 20 Mar 2018 08:48:17 +0100 Subject: [PATCH] Fix #825 : use is_used_in_promo_rules instead of is_searchable for the image attribute. --- src/module-elasticsuite-catalog/Setup/CatalogSetup.php | 2 +- src/module-elasticsuite-catalog/Setup/UpgradeData.php | 4 ++++ src/module-elasticsuite-catalog/etc/module.xml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/module-elasticsuite-catalog/Setup/CatalogSetup.php b/src/module-elasticsuite-catalog/Setup/CatalogSetup.php index 497da0be2..8fc68656a 100644 --- a/src/module-elasticsuite-catalog/Setup/CatalogSetup.php +++ b/src/module-elasticsuite-catalog/Setup/CatalogSetup.php @@ -288,7 +288,7 @@ public function updateImageAttribute($eavSetup) $setup->getConnection()->update( $setup->getTable('catalog_eav_attribute'), - ['is_searchable' => 1], + ['is_used_for_promo_rules' => 1, 'is_searchable' => 0, 'is_used_in_spellcheck' => 0], $setup->getConnection()->quoteInto('attribute_id = ?', $productImageAttributeId) ); } diff --git a/src/module-elasticsuite-catalog/Setup/UpgradeData.php b/src/module-elasticsuite-catalog/Setup/UpgradeData.php index 7b0532700..b91f894ef 100644 --- a/src/module-elasticsuite-catalog/Setup/UpgradeData.php +++ b/src/module-elasticsuite-catalog/Setup/UpgradeData.php @@ -73,6 +73,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $this->catalogSetup->updateImageAttribute($eavSetup); } + if (version_compare($context->getVersion(), '1.4.1', '<')) { + $this->catalogSetup->updateImageAttribute($eavSetup); + } + $setup->endSetup(); } } diff --git a/src/module-elasticsuite-catalog/etc/module.xml b/src/module-elasticsuite-catalog/etc/module.xml index 846a7d93c..ec50cb5f1 100644 --- a/src/module-elasticsuite-catalog/etc/module.xml +++ b/src/module-elasticsuite-catalog/etc/module.xml @@ -17,7 +17,7 @@ */ --> - +