File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
app/code/Magento/CatalogSearch Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \CatalogSearch \Observer ;
9
+
10
+ use Magento \Catalog \Model \Product \ProductList \ToolbarMemorizer ;
11
+ use Magento \Framework \Event \Observer ;
12
+ use Magento \Framework \Event \ObserverInterface ;
13
+
14
+ class ToolbarMemorizerObserver implements ObserverInterface
15
+ {
16
+ /**
17
+ * @var ToolbarMemorizer
18
+ */
19
+ private $ toolbarMemorizer ;
20
+
21
+ /**
22
+ * ToolbarMemoriserObserver constructor.
23
+ * @param ToolbarMemorizer $toolbarMemorizer
24
+ */
25
+ public function __construct (ToolbarMemorizer $ toolbarMemorizer )
26
+ {
27
+ $ this ->toolbarMemorizer = $ toolbarMemorizer ;
28
+ }
29
+
30
+ /**
31
+ * Save toolbar parameters in catalog session
32
+ *
33
+ * @param Observer $observer
34
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
+ */
36
+ public function execute (Observer $ observer ): void
37
+ {
38
+ $ this ->toolbarMemorizer ->memorizeParams ();
39
+ }
40
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Event/etc/events.xsd" >
9
+ <event name =" controller_action_predispatch_catalogsearch_advanced_result" >
10
+ <observer name =" catalog_sort_param_memorization" instance =" Magento\CatalogSearch\Observer\ToolbarMemorizerObserver" />
11
+ </event >
12
+ <event name =" controller_action_predispatch_catalogsearch_result_index" >
13
+ <observer name =" catalog_sort_param_memorization" instance =" Magento\CatalogSearch\Observer\ToolbarMemorizerObserver" />
14
+ </event >
15
+ </config >
You can’t perform that action at this time.
0 commit comments