Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
[FACTFINDER-178] Rewrite Fulltext model to prevent sql exceptions #157
Browse files Browse the repository at this point in the history
  • Loading branch information
xpoback committed Jul 27, 2016
1 parent d12cc5c commit 3fd9fb2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/app/code/community/FACTFinder/Core/Model/Resource/Fulltext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* FACTFinder_Core
*
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <[email protected]>
* @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 <[email protected]>
* @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);
}
}
5 changes: 5 additions & 0 deletions src/app/code/community/FACTFinder/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<query>FACTFinder_Core_Model_CatalogSearch_Query</query>
</rewrite>
</catalogsearch>
<catalogsearch_resource>
<rewrite>
<fulltext>FACTFinder_Core_Model_Resource_Fulltext</fulltext>
</rewrite>
</catalogsearch_resource>
</models>
<blocks>
<factfinder>
Expand Down

0 comments on commit 3fd9fb2

Please sign in to comment.