File tree Expand file tree Collapse file tree 5 files changed +113
-0
lines changed
Expand file tree Collapse file tree 5 files changed +113
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * OpenMage
5+ *
6+ * This source file is subject to the Open Software License (OSL 3.0)
7+ * that is bundled with this package in the file LICENSE.txt.
8+ * It is also available at https://opensource.org/license/osl-3-0-php
9+ *
10+ * @category Mage
11+ * @package Mage_Catalog
12+ * @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
13+ * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14+ */
15+
16+ /**
17+ * Catalog search helper
18+ *
19+ * @category Mage
20+ * @package Mage_Catalog
21+ */
22+ class Mage_Catalog_Helper_Search extends Mage_Core_Helper_Abstract
23+ {
24+ protected $ _moduleName = 'Mage_Catalog ' ;
25+
26+ /**
27+ * @SuppressWarnings("PHPMD.StaticAccess")
28+ */
29+ public function isNotEnabled (): bool
30+ {
31+ return !Mage::getStoreConfigFlag ('catalog/search/enable_advanced_search ' );
32+ }
33+
34+ /**
35+ * @SuppressWarnings("PHPMD.StaticAccess")
36+ */
37+ public function getNoRoutePath (): string
38+ {
39+ return $ this ->_getUrl (Mage::getStoreConfig ('web/default/cms_no_route ' ));
40+ }
41+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * OpenMage
5+ *
6+ * This source file is subject to the Open Software License (OSL 3.0)
7+ * that is bundled with this package in the file LICENSE.txt.
8+ * It is also available at https://opensource.org/license/osl-3-0-php
9+ *
10+ * @category Mage
11+ * @package Mage_Catalog
12+ * @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
13+ * @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
14+ * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15+ */
16+
17+ /**
18+ * Catalog Observer
19+ *
20+ * @category Mage
21+ * @package Mage_Catalog
22+ */
23+ class Mage_Catalog_Model_Observer_DisableAdvancedSearch
24+ {
25+ /**
26+ * Disable Advanced Search at storeview scope
27+ *
28+ * @SuppressWarnings("PHPMD.StaticAccess")
29+ */
30+ public function execute (Varien_Event_Observer $ observer ): void
31+ {
32+ /** @var Mage_Catalog_Helper_Search $helper */
33+ $ helper = Mage::helper ('catalog/search ' );
34+ if ($ helper ->isNotEnabled ()) {
35+ $ observer ->getControllerAction ()->getResponse ()->setRedirect ($ helper ->getNoRoutePath ());
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 706706 </catalog >
707707 </observers >
708708 </sales_convert_quote_item_to_order_item >
709+ <controller_action_predispatch_catalogsearch_advanced_index >
710+ <observers >
711+ <disable_advanced_search >
712+ <class >catalog/observer_disableAdvancedSearch</class >
713+ <method >execute</method >
714+ </disable_advanced_search >
715+ </observers >
716+ </controller_action_predispatch_catalogsearch_advanced_index >
717+ <controller_action_predispatch_catalogsearch_advanced_result >
718+ <observers >
719+ <disable_advanced_search >
720+ <class >catalog/observer_disableAdvancedSearch</class >
721+ <method >execute</method >
722+ </disable_advanced_search >
723+ </observers >
724+ </controller_action_predispatch_catalogsearch_advanced_result >
709725 </events >
710726 <translate >
711727 <modules >
816832 <interval_division_limit >9</interval_division_limit >
817833 <display_product_count >0</display_product_count >
818834 </layered_navigation >
835+ <search >
836+ <enable_advanced_search >1</enable_advanced_search >
837+ </search >
819838 </catalog >
820839 <system >
821840 <media_storage_configuration >
Original file line number Diff line number Diff line change 457457 </fields>
458458 </layer>
459459-->
460+
461+ <search >
462+ <fields >
463+ <enable_advanced_search translate =" label" >
464+ <label >Enable Advanced Search</label >
465+ <frontend_type >select</frontend_type >
466+ <source_model >adminhtml/system_config_source_enabledisable</source_model >
467+ <sort_order >800</sort_order >
468+ <show_in_default >1</show_in_default >
469+ <show_in_website >1</show_in_website >
470+ <show_in_store >1</show_in_store >
471+ </enable_advanced_search >
472+ </fields >
473+ </search >
460474 </groups >
461475 </catalog >
462476 <design >
Original file line number Diff line number Diff line change 283283" Email" , " Email"
284284" Email to a Friend" , " Email to a Friend"
285285" Empty" , " Empty"
286+ " Enable Advanced Search" , " Enable Advanced Search"
286287" Enable MAP" , " Enable MAP"
287288" Enable Qty Increments" , " Enable Qty Increments"
288289" Enable WYSIWYG" , " Enable WYSIWYG"
You can’t perform that action at this time.
0 commit comments