Search code examples
phpmagentomagento-1.7

Magento CE 1.7.0.2 - Issue only occurs with caching enabled on footer.phtml


I'm experiencing this problem with Magento when caching is enabled...

Problem:

Using the following in footer I can get the current CMS page title:

$this->getLayout()->getBlock('head')->getTitle();

^^ I have used this and other methods getting current URL in footer and experience same symptoms. With caching off it gets the current page no problem but with caching on it will get for example the page title for the shop then visiting other page shows that it is still shop.

Here is a problem scenario with caching enabled:

  1. Visit homepage (http://devtest.eboost.com/).

  2. Navigate to blog and scroll to the bottom so you can see footer. The hyperlinks for Powders, Shots, and some from Company should be different on homepage and all other pages. It behaves just fine with caching off. The links work fine in header.phtml and has the same logic.

Thing is with caching enabled it doesn't behave like this when in the header.phtml file so I'm confused. Do I need to do something special or maybe somehow take footer.phtml out of cache monitoring? I don't think removing it from cache monitoring would be wise because we have most of our JavaScript in this document.

I'm not sure what to do and very pressured to figure this out to make our client's website live.


Solution

  • Update: @benmarks 's Answer is miles better. Use that.

    Try removing the footer from the cache. Try this - http://ken.edmonds-commerce.co.uk/magento/disable-footer-block-caching-in-magento/