0

I have separate headers for different pages of our store. A different format is displayed based upon the page being visited. For example, the homepage is different than category pages. Occasionally the headers themselves cache over one another and this state is persistent until the cache is flushed.

What causes this and how can I fix it?

Enterprise Edition 1.9.

easymoden00b
  • 1,277
  • 2
  • 26
  • 55

1 Answers1

1

You should try this answer. Wrap your code in a block and set the block cache lifetime to 0 while calling it from an XML. If you are using $this->getChildHtml('header'); you can add false as the second parameter and the HTML will be fresh like this $this->getChildHtml('header',false);. That way your header block will be never cached.

mbalparda
  • 7,363
  • 3
  • 23
  • 46
  • Won't removing the header from cache cause significantly larger amounts of server load / response time (over thousands of page views). – easymoden00b Dec 23 '14 at 13:26
  • Yes. But that is what you asked. You can wrap only the part you want and use this approach if you don't want to disable the cache on everything in the header. – mbalparda Dec 23 '14 at 13:27
  • Well, thank you for your correct answer. Are you familiar enough to know what may be causing this to not 'just work'? – easymoden00b Dec 23 '14 at 13:32
  • What do you mean by not just work? – mbalparda Dec 23 '14 at 13:32
  • Why is it that the header is essentially not following the correct logic? I have an 'if' statement that checks the page and displays the correct contents, but in this case it occasionally doesn't work. – easymoden00b Dec 23 '14 at 13:42