I'm having a problem with Magento blockcache and FPC turned on. I'm trying to output some category information in the page footer, but that block doesn't seem to be able to get the right category information. When I output the same thing into the categorys view.phtml file it workes fine, but in the footer the cache will not recognize the different categories and output from first visited category page.
I've tried getting the category information with (syntax from memory, might not be accurate):
- Magento::registry('current_category')
- Changing the block type to category_view and using same method as the prduct listing, with $this->getCurrentCategory()-getId();
- checking how the block code for category listing loads the data, using the request ID and loading the category object from scratch.
All of these methods fail, and will basically show the wrong category ID and info except for maybe the first one I visit.
The block isn't part of a module, just a phtml file included in local.xml but in my attempts I've also tried making a basic module and doing it in a block file.
It seems as if the block output is global based on the XML block name, and not tied into the FPC view? Also, I'm unsure of how the product listing block manages to get the right category data out but it seems damn near impossible in any other part of the page?
Am I forced to try and solve it with hole punching? Becasue I've tried that too. Didn't work, or maybe I didn't get the holepunching to function since I've never done it before..
The thing is that I'd actually want this block to be cached, just not in a global fashion - but instead based on what category I'm on. Any suggestions or insight into how and why I might solve this?
I could perhaps output the info I want in the product listing part and move it down with js, but I would very much prefer not to as you might imagine.