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

Commit

Permalink
[FACTFINDER-174] Prevent writing queries to the db when FF is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
xpoback committed May 11, 2016
1 parent 509cec5 commit 00813e0
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* View.php
*
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <[email protected]>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG
* @license GPL
* @link http://www.flagbit.de
*/
class FACTFinder_Core_Block_CatalogSearch_Layer extends Mage_CatalogSearch_Block_Layer
{


/**
* Rewrite the block to prevent using default layer model
*
* @return FACTFinder_Core_Model_CatalogSearch_Layer|Mage_Catalog_Model_Layer
*/
public function getLayer()
{
if (Mage::helper('factfinder')->isEnabled()) {
return Mage::getSingleton('factfinder/catalogSearch_layer');
}

return parent::getLayer();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Query.php
*
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <[email protected]>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG
* @license GPL
* @link http://www.flagbit.de
*/

class FACTFinder_Core_Model_CatalogSearch_Query extends Mage_CatalogSearch_Model_Query
{


/**
* Rewrite the model to prevent savin data to the db if FF is enabled
*
* @return $this|\Mage_Core_Model_Abstract
*
* @throws \Exception
*/
public function save()
{
if (Mage::helper('factfinder')->isEnabled()) {
return $this;
}

return parent::save();
}


}
10 changes: 10 additions & 0 deletions src/app/code/community/FACTFinder/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@
<factfinder_core_resource>
<class>FACTFinder_Core_Model_Resource</class>
</factfinder_core_resource>
<catalogsearch>
<rewrite>
<query>FACTFinder_Core_Model_CatalogSearch_Query</query>
</rewrite>
</catalogsearch>
</models>
<blocks>
<factfinder>
<class>FACTFinder_Core_Block</class>
</factfinder>
<catalogsearch>
<rewrite>
<layer>FACTFinder_Core_Block_CatalogSearch_Layer</layer>
</rewrite>
</catalogsearch>
</blocks>
<helpers>
<factfinder>
Expand Down

0 comments on commit 00813e0

Please sign in to comment.