0

I'm running a split A-B test on a couple of homepage layouts. There's an observer that sets up the session variable (group A or group B) and then the layout changes based on that variable.

The problem is that the page is caching (in the Magento full-page cache) and no matter what group the user is in, they are all seeing either the A page or B page.

Can I modify Magento so that each version of the homepage caches seperately? Or can I disable caching entirely on the homepage? Or is there a better way to do this kind of test?

Dave Child
  • 7,573
  • 2
  • 25
  • 37
  • You should implement full page cache hole punching for your block. See this tutorial [this tutorial](http://tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching) and [this question on SO](http://stackoverflow.com/questions/8126548/trying-get-dynamic-content-hole-punched-through-magentos-full-page-cache). – Dmytro Zavalkin Jan 31 '12 at 12:28

2 Answers2

0

This doesn't directly apply, but I had to cache the footer differently depending on which page it was on, and ended up editing the Mage/Page/Block/Html/Footer.php file and changing the getCacheKey() function by adding part of the url to the returned variable. Could you not append the session variable instead?

I understand you are not looking at the footer as I was, but it seemed like it might point you in a helpful direction.

Alex Hadley
  • 2,125
  • 2
  • 28
  • 50
0

You could use an HTTP 1.1 compliant header to alter the caching behaviours for the specific page.

See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.6

The header you require is Cache-Control: no-cache.

You need to send that header out with the document. Using php, you would use the header function to specify headers.

header("Cache-Control: no-cache");
Shane
  • 2,007
  • 18
  • 33
  • Sorry, I wasn't clear enough in my question. It's the internal Magento cache that's being problematic, not the browser cache. – Dave Child Jan 31 '12 at 11:40