diff --git a/src/app/code/community/FACTFinder/Core/Model/Resource/Fulltext.php b/src/app/code/community/FACTFinder/Core/Model/Resource/Fulltext.php new file mode 100644 index 00000000..901f765b --- /dev/null +++ b/src/app/code/community/FACTFinder/Core/Model/Resource/Fulltext.php @@ -0,0 +1,45 @@ + + * @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG + * @license https://opensource.org/licenses/MIT The MIT License (MIT) + * @link http://www.flagbit.de + * + */ + +/** + * Model class + * + * @category Mage + * @package FACTFinder_Core + * @author Flagbit Magento Team + * @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG (http://www.flagbit.de) + * @license https://opensource.org/licenses/MIT The MIT License (MIT) + * @link http://www.flagbit.de + */ +class FACTFinder_Core_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext +{ + + + /** + * Override this method to prevent making unnecessary sql requests if FF is enabled + * + * @param Mage_CatalogSearch_Model_Fulltext $object + * @param string $queryText + * @param Mage_CatalogSearch_Model_Query $query + * + * @return FACTFinder_Core_Model_Resource_Fulltext + */ + public function prepareResult($object, $queryText, $query) + { + if (Mage::helper('factfinder')->isEnabled()) { + return $this; + } + + return parent::prepareResult($object, $queryText, $query); + } +} \ No newline at end of file diff --git a/src/app/code/community/FACTFinder/Core/etc/config.xml b/src/app/code/community/FACTFinder/Core/etc/config.xml index ba99e4d8..a38f1f9a 100644 --- a/src/app/code/community/FACTFinder/Core/etc/config.xml +++ b/src/app/code/community/FACTFinder/Core/etc/config.xml @@ -32,6 +32,11 @@ FACTFinder_Core_Model_CatalogSearch_Query + + + FACTFinder_Core_Model_Resource_Fulltext + +