problem getting current url when cache is turned on

by jodaki   Last Updated January 12, 2018 17:09 PM

Summary

  • This problem is affecting my Venus Theme Mega Menu module.
  • When caching is turned on the menu no longer shows correct .active classes for the current page.
  • I'm looking in the module code where the .active page is set (app/code/Ves/Megamenu/Helper/Data.php)
  • The default magento menu does not suffer this problem.
  • I'm using SSL for storefront pages

Details

When caching is turned off the following two vendor methods both return the correct current url:

$this->_storeManager->getStore()->getCurrentUrl() and $this->_urlInterface->getCurrentUrl()

When caching is turned on both methods return only the URL of the first page that is loaded after the cache is turned on.

Example

Does anyone know why the caching should interfere with these methods and if there is anything I can do to correct it.

many thanks

Tags : magento2 cache


Related Questions


How to clear cache on page loading magento 2?

Updated December 20, 2017 07:09 AM

Magento 2: Cacheable false for specific block not working

Updated September 02, 2016 08:05 AM


what is the block name for price block?

Updated April 26, 2015 21:04 PM

removing a template from the cache

Updated July 14, 2015 17:04 PM