Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Block Cache #4

Closed
kestraly opened this issue Oct 18, 2020 · 3 comments
Closed

Menu Block Cache #4

kestraly opened this issue Oct 18, 2020 · 3 comments

Comments

@kestraly
Copy link

Judging by the timings. The menu is not stored in block cache?

@magepow
Copy link
Collaborator

magepow commented Oct 21, 2020

@kestraly Thanks for the report. I have added a block cache, please check again.

@kestraly
Copy link
Author

kestraly commented Oct 21, 2020

So I found the best solution was to a specific megamenu cache.

This reduced the load time of the menu on a large store from 6 seconds to 0.6 seconds once cached.

Using this technique
https://www.optiweb.com/blog/magento-2-custom-cache-type/

I can put in a pull request with this. The only issue is the loss of the is_active feature.

Adding the is_active feature through JQuery might be a better solution, so that you can have a fully cached menu that loads instantly and then jQuery highlights the active category by adding into the menu li data-categoryid="CATEGORY_ID"

example
<li class="level0 category-item level-top" data-categoryid="10">Shop Online</li>

Then with jQuery something like that's on the page

$("magicmenu ul").find('[data-categoryid='10']').addClass('active');

@kestraly
Copy link
Author

Closing - Added Pull Request
#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant