Published: April 25, 2021
Last updated:

Amasty FPC extension broken after upgrade to OpenMage

After upgrade to OpenMage v19.4.8 or newer version Amasty FPC extension is broken.

Cause

The problem is in Frontend cookie session name. The cookie session name was changed in OpenMage v19.4.8 (see issue #990) and session name was hardcoded in Amasty FPC extension, so it could not detect session properly.

Solution

Obtain a newer Amasty FPC module version or request a patch from Amasty or use the following proven to work changes in the extension:
diff --git a/app/code/local/Amasty/Fpc/Model/Fpc.php b/app/code/local/Amasty/Fpc/Model/Fpc.php
index c2ce1cf..0ca387a 100755
--- a/app/code/local/Amasty/Fpc/Model/Fpc.php
+++ b/app/code/local/Amasty/Fpc/Model/Fpc.php
@@ -257,7 +257,9 @@ class Amasty_Fpc_Model_Fpc extends Mage_Core_Model_Cache
                     'size' => strlen($data),
                     'type' => 'page',
                     'customer_group' => Mage::getSingleton('amfpc/fpc_front')->getCustomerGroupId(),
-                    'session' => $_COOKIE['frontend']
+                    'session' => isset($_COOKIE[Mage_Core_Controller_Front_Action::SESSION_NAMESPACE])
+                        ? $_COOKIE[Mage_Core_Controller_Front_Action::SESSION_NAMESPACE]
+                        : ''
                 ))
                 ->save();
         }
@@ -465,7 +467,9 @@ class Amasty_Fpc_Model_Fpc extends Mage_Core_Model_Cache
                     'type' => 'block',
                     'block_name' => $name,
                     'customer_group' => Mage::getSingleton('amfpc/fpc_front')->getCustomerGroupId(),
-                    'session' => isset($_COOKIE['frontend']) ? $_COOKIE['frontend'] : ''
+                    'session' => isset($_COOKIE[Mage_Core_Controller_Front_Action::SESSION_NAMESPACE])
+                        ? $_COOKIE[Mage_Core_Controller_Front_Action::SESSION_NAMESPACE]
+                        : ''
                 ))
                 ->save();
         }
diff --git a/app/code/local/Amasty/Fpc/Model/Fpc/Front.php b/app/code/local/Amasty/Fpc/Model/Fpc/Front.php
index bb83b66..9a1821b 100644
--- a/app/code/local/Amasty/Fpc/Model/Fpc/Front.php
+++ b/app/code/local/Amasty/Fpc/Model/Fpc/Front.php
@@ -34,7 +34,7 @@ class Amasty_Fpc_Model_Fpc_Front extends Varien_Object
     protected static $_isAjax = null;
 
     protected $_cache = null;
-    protected $_sessionName = 'frontend';
+    protected $_sessionName = Mage_Core_Controller_Front_Action::SESSION_NAMESPACE;
     protected $_sessionStarted = false;
 
     protected $_formKey = null;
@@ -92,9 +92,7 @@ class Amasty_Fpc_Model_Fpc_Front extends Varien_Object
         }
         else
         {
-            $sessionName = (string)Mage::app()
-                ->getConfig()
-                ->getNode('global/amfpc/session_name');
+            $sessionName = Mage_Core_Controller_Front_Action::SESSION_NAMESPACE;
 
             if ($sessionName) {
                 $this->_sessionName = $sessionName;

Posted in: Known issues

4 votes, 3.50 avg. rating (70% score)