File tree Expand file tree Collapse file tree 4 files changed +38
-18
lines changed Expand file tree Collapse file tree 4 files changed +38
-18
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ class Lesti_Fpc_Helper_Data extends Lesti_Fpc_Helper_Abstract
18
18
{
19
19
const XML_PATH_CACHEABLE_ACTIONS = 'system/fpc/cache_actions ' ;
20
20
const XML_PATH_BYPASS_HANDLES = 'system/fpc/bypass_handles ' ;
21
- const XML_PATH_SESSION_PARAMS = 'system/fpc/session_params ' ;
22
21
const XML_PATH_URI_PARAMS = 'system/fpc/uri_params ' ;
23
22
const XML_PATH_CUSTOMER_GROUPS = 'system/fpc/customer_groups ' ;
24
23
const XML_PATH_REFRESH_ACTIONS = 'system/fpc/refresh_actions ' ;
@@ -88,15 +87,7 @@ protected function _getParams()
88
87
$ params ['customer_group_id ' ] = $ customerSession
89
88
->getCustomerGroupId ();
90
89
}
91
- if ($ this ->getFullActionName () === 'catalog_category_view ' ) {
92
- $ sessionParams = $ this ->_getSessionParams ();
93
- $ catalogSession = Mage::getSingleton ('catalog/session ' );
94
- foreach ($ sessionParams as $ param ) {
95
- if ($ data = $ catalogSession ->getData ($ param )) {
96
- $ params ['session_ ' . $ param ] = $ data ;
97
- }
98
- }
99
- }
90
+
100
91
// edit parameters via event
101
92
$ parameters = new Varien_Object ();
102
93
$ parameters ->setValue ($ params );
@@ -137,14 +128,6 @@ public function _getUriParams()
137
128
return $ this ->getCSStoreConfigs (self ::XML_PATH_URI_PARAMS );
138
129
}
139
130
140
- /**
141
- * @return array
142
- */
143
- protected function _getSessionParams ()
144
- {
145
- return $ this ->getCSStoreConfigs (self ::XML_PATH_SESSION_PARAMS );
146
- }
147
-
148
131
/**
149
132
* @return array
150
133
*/
Original file line number Diff line number Diff line change 16
16
*/
17
17
class Lesti_Fpc_Model_Observer_Parameters
18
18
{
19
+ const XML_PATH_SESSION_PARAMS = 'system/fpc/session_params ' ;
20
+
19
21
/**
20
22
* @param $observer
21
23
*/
@@ -36,10 +38,31 @@ public function fpcHelperCollectParams($observer)
36
38
$ design = Mage::getDesign ();
37
39
$ params ['design ' ] = $ design ->getPackageName ().'_ ' .
38
40
$ design ->getTheme ('template ' );
41
+ // session paramaters
42
+ /** @var Lesti_Fpc_Helper_Data $helper */
43
+ $ helper = Mage::helper ('fpc ' );
44
+ if ($ helper ->getFullActionName () === 'catalog_category_view ' ) {
45
+ $ sessionParams = $ this ->_getSessionParams ();
46
+ $ catalogSession = Mage::getSingleton ('catalog/session ' );
47
+ foreach ($ sessionParams as $ param ) {
48
+ if ($ data = $ catalogSession ->getData ($ param )) {
49
+ $ params ['session_ ' . $ param ] = $ data ;
50
+ }
51
+ }
52
+ }
39
53
40
54
$ parameters = $ observer ->getEvent ()->getParameters ();
41
55
$ additionalParams = $ parameters ->getValue ();
42
56
$ additionalParams = array_merge ($ additionalParams , $ params );
43
57
$ parameters ->setValue ($ additionalParams );
44
58
}
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ protected function _getSessionParams ()
64
+ {
65
+ $ helper = Mage::helper ('fpc ' );
66
+ return $ helper ->getCSStoreConfigs (self ::XML_PATH_SESSION_PARAMS );
67
+ }
45
68
}
Original file line number Diff line number Diff line change @@ -18,15 +18,25 @@ class Lesti_Fpc_Test_Model_Observer_Parameters extends Lesti_Fpc_Test_TestCase
18
18
{
19
19
/**
20
20
* @test
21
+ * @loadFixture fpc_helper_collect_params.yaml
21
22
*/
22
23
public function testFpcHelperCollectParams ()
23
24
{
25
+ Mage::app ()->getRequest ()->setRouteName ('catalog ' );
26
+ Mage::app ()->getRequest ()->setControllerName ('category ' );
27
+ Mage::app ()->getRequest ()->setActionName ('view ' );
28
+
29
+ /** @var Mage_Catalog_Model_Session $catalogSession */
30
+ $ catalogSession = Mage::getSingleton ('catalog/session ' );
31
+ $ catalogSession ->setData ('fpc ' , 'cool ' );
32
+
24
33
$ expectedResult = array (
25
34
'fpc ' => 'cool ' ,
26
35
'store ' => Mage::app ()->getStore (true )->getCode (),
27
36
'currency ' => Mage::app ()->getStore ()->getCurrentCurrencyCode (),
28
37
'design ' => Mage::getDesign ()->getPackageName ().'_ ' .
29
38
Mage::getDesign ()->getTheme ('template ' ),
39
+ 'session_fpc ' => 'cool ' ,
30
40
);
31
41
$ params = array ('fpc ' => 'cool ' );
32
42
$ object = new Varien_Object ();
Original file line number Diff line number Diff line change
1
+ config :
2
+ default/system/fpc/session_params : >
3
+ magento,
4
+ fpc
You can’t perform that action at this time.
0 commit comments