1

I made an extension that adds an item to the header navigation if you are within a certain user group. However, because of caching, it wont always show after logging in and wont always go away if you log out.

Is there a way around this? I could disable caching for the block I think but it would cause the page itself to not cache and being that its on every page that would slow down the site dramatically.

4
  • Why do you think it would cause the whole page not to cache? Commented Jan 6, 2017 at 15:32
  • Read in a comment here magento.stackexchange.com/questions/103256/… Commented Jan 6, 2017 at 15:39
  • Thanks, that was helpful. +1 on the question; I'm curious too... Commented Jan 6, 2017 at 15:42
  • Please, read this article (dev docs) Commented Mar 13, 2017 at 11:04

1 Answer 1

2

(1) One option could be to create new controller what would return menu item(s) on POST ajax-call and store the result to browser's localStorage.

Call is made only then when there isn't any result yet in localStorage.

(2) Other option is to try builtin private content approach:

In following link has been mentioned that you need to use CustomerData sections for that:

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.