diff --git a/src/app/code/community/FACTFinder/Core/Block/CatalogSearch/Layer.php b/src/app/code/community/FACTFinder/Core/Block/CatalogSearch/Layer.php new file mode 100644 index 00000000..acbe7921 --- /dev/null +++ b/src/app/code/community/FACTFinder/Core/Block/CatalogSearch/Layer.php @@ -0,0 +1,31 @@ +<?php +/** + * View.php + * + * @category Mage + * @package FACTFinder_Core + * @author Flagbit Magento Team <magento@flagbit.de> + * @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(); + } + + +} \ No newline at end of file diff --git a/src/app/code/community/FACTFinder/Core/Model/CatalogSearch/Query.php b/src/app/code/community/FACTFinder/Core/Model/CatalogSearch/Query.php new file mode 100644 index 00000000..da43f4ea --- /dev/null +++ b/src/app/code/community/FACTFinder/Core/Model/CatalogSearch/Query.php @@ -0,0 +1,34 @@ +<?php +/** + * Query.php + * + * @category Mage + * @package FACTFinder_Core + * @author Flagbit Magento Team <magento@flagbit.de> + * @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(); + } + + +} \ 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 3ff63d8e..b8e0df6f 100644 --- a/src/app/code/community/FACTFinder/Core/etc/config.xml +++ b/src/app/code/community/FACTFinder/Core/etc/config.xml @@ -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>