Vikas Pal
Vikas Pal

Reputation: 81

Magento EE 1.11.1, Full Page Cache issue with mobile theme?

I've went through many forums, but I was unable to solve the FPC problem in Magento EE 1.11 version. When I browsing the mobile theme it is taking web theme instead, because of FPC. If I disable the FPC, the performance will go down.

Can somebody help me to solve this problem?

Upvotes: 2

Views: 1640

Answers (3)

tomg
tomg

Reputation: 369

A simple solution that does not require any patching of code:

Add an exception with the same regex-expression as you have in the themes-section into the package section and link it to the exact same package name as the "Current Package Name" is set to.

Prereqs:
Only one exception per section on the theme levels, e.g., iPhone|iPad -> iphone
(and not iPhone -> iphone + iPad -> iphone)

Explanation why it works:
The enterprise page-caching is taking the package exceptions into account when generating the cacheid.
It does however not check if the package names are identical!
So even if the exception package is identical as the main, a different cacheid will be generated, and since the regex exceptions in the themes section are identical, they will be stored in the full page cache using the new chacheid.

Example: In the "enterprise" package, there are 2 themes "default" and "iphone".
You wish to run the theme "iphone" by adding the exception iPhone|iPad for the "Templates", "Skin" and "Layout" in the "Themes" subsection.

In the "Package" subsection:
Set "Current Package Name" to "enterprise".
Add an exception to the package with iPhone|iPad -> "enterprise"

In the "Themes" subsection:
Add an exception to the "Templates" with iPhone|iPad -> enterprise
Add an exception to the "Skin" with iPhone|iPad -> enterprise
Add an exception to the "Layout" with iPhone|iPad -> enterprise
Set "Default" to "default"

Note: Do not forget to clear the FPC in System->Cache Management before testing it.

Upvotes: 1

Ben
Ben

Reputation: 1535

The theme is not used as part of the FPC uri and therefore there is only one cache per package.

I wrote a little extension to fix the issue and you can grab it on Github.

https://github.com/benjy14/MobileFpcFix

Upvotes: 2

beeplogic
beeplogic

Reputation: 478

I have a feeling that the design exceptions support in Enterprise/PageCache work at the package level and not the theme level. Take a look at the code referencing design exceptions in app/code/core/Enterprise/PageCache/Model/Observer.php. My first suggestion would be to contact EE support, perhaps they can provide an appropriate solution or a patch. Alternatively, you can modify the caching key mechanism by rewriting enterprise_pagecache/processor:

public function prepareCacheId($id)
{
    $package         = Mage::getDesign()->getPackageName();
    $templateTheme   = Mage::getDesign()->getTheme('template');
    $id              = $id.'_'.$package.'_'.$templateTheme;
    return parent::prepareCacheId($id);
}

Upvotes: 1

Related Questions