-
-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make fulltext search separator (OR/AND) configurable from backend (#1852
- Loading branch information
Showing
8 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Separator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class Mage_Adminhtml_Model_System_Config_Backend_Catalog_Search_Separator extends Mage_Core_Model_Config_Data | ||
{ | ||
/** | ||
* After change Catalog Search Type process | ||
* | ||
* @return $this | ||
*/ | ||
protected function _afterSave() | ||
{ | ||
$newValue = $this->getValue(); | ||
$oldValue = Mage::getConfig()->getNode( | ||
Mage_CatalogSearch_Model_Fulltext::XML_PATH_CATALOG_SEARCH_SEPARATOR, | ||
$this->getScope(), | ||
$this->getScopeId() | ||
); | ||
if ($newValue != $oldValue) { | ||
Mage::getSingleton('catalogsearch/fulltext')->resetSearchResults(); | ||
} | ||
|
||
return $this; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Separator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Mage_Adminhtml_Model_System_Config_Source_Catalog_Search_Separator | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
$types = [ | ||
' OR ' => 'OR (default)', | ||
' AND ' => 'AND' | ||
]; | ||
$options = []; | ||
foreach ($types as $k => $v) { | ||
$options[] = [ | ||
'value' => $k, | ||
'label' => $v | ||
]; | ||
} | ||
return $options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters