diff --git a/app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php b/app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php index b18de11f..5ce8182d 100644 --- a/app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php +++ b/app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php @@ -5,6 +5,10 @@ */ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Facets extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField { + const SEARCHABLE = '1'; + const NOT_SEARCHABLE = '2'; + const FILTER_ONLY = '3'; + protected $_isQueryRulesDisabled; public function __construct() @@ -44,10 +48,11 @@ public function __construct() 'style' => 'width: 100px;', ), 'searchable' => array( - 'label' => 'Searchable?', + 'label' => 'Modifier', 'options' => array( - '1' => 'Yes', - '2' => 'No' + self::SEARCHABLE => 'Searchable', + self::NOT_SEARCHABLE => 'Not Searchable', + self::FILTER_ONLY => 'Filter Only', ), 'rowMethod' => 'getSearchable', ), diff --git a/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php b/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php index 02b0c260..e28a8b12 100644 --- a/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +++ b/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php @@ -258,8 +258,12 @@ public function setSettings($storeId, $saveToTmpIndicesToo = false) } } else { $attribute = $facet['attribute']; - if (array_key_exists('searchable', $facet) && $facet['searchable'] === '1') { - $attribute = 'searchable('.$attribute.')'; + if (array_key_exists('searchable', $facet)) { + if ($facet['searchable'] === Algolia_Algoliasearch_Block_System_Config_Form_Field_Facets::SEARCHABLE) { + $attribute = 'searchable(' . $attribute . ')'; + } elseif ($facet['searchable'] === Algolia_Algoliasearch_Block_System_Config_Form_Field_Facets::FILTER_ONLY) { + $attribute = 'filterOnly(' . $attribute . ')'; + } } $attributesForFaceting[] = $attribute; diff --git a/app/code/community/Algolia/Algoliasearch/etc/system.xml b/app/code/community/Algolia/Algoliasearch/etc/system.xml index 88f200d5..d4aea5a5 100644 --- a/app/code/community/Algolia/Algoliasearch/etc/system.xml +++ b/app/code/community/Algolia/Algoliasearch/etc/system.xml @@ -406,6 +406,8 @@
Set facet as searchable if you want your customers to be able to search for facet values. It's handy when a facet has a lot of values.
+ Set facet as Filter Only if only the filtering feature is needed. +
Facets' documentation: https://community.algolia.com/magento/doc/m1/indexing/#facets