Skip to content

Commit e41f6cc

Browse files
author
Bohdan Korablov
committed
MAGETWO-49796: Catalog top nav, CSS class not set to active when using Varnish
1 parent c6df629 commit e41f6cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/web/mage/menu.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,17 @@ define([
199199
*/
200200
_setActiveMenuForProduct: function (currentUrl) {
201201
var categoryUrlExtension,
202+
lastUrlSection,
202203
possibleCategoryUrl,
203204
//retrieve first category URL to know what extension is used for category URLs
204205
firstCategoryUrl = this.element.find('> li a').attr('href');
205206

206207
if (firstCategoryUrl) {
207-
categoryUrlExtension = firstCategoryUrl.substr(firstCategoryUrl.lastIndexOf('.'));
208+
lastUrlSection = firstCategoryUrl.substr(firstCategoryUrl.lastIndexOf('/'));
209+
categoryUrlExtension = (lastUrlSection.lastIndexOf('.') !== -1)
210+
? lastUrlSection.substr(lastUrlSection.lastIndexOf('.')) : '';
211+
212+
//categoryUrlExtension = lastUrlSection.substr(lastUrlSection.lastIndexOf('.'));
208213
possibleCategoryUrl = currentUrl.substr(0, currentUrl.lastIndexOf('/')) + categoryUrlExtension;
209214
this._setActiveMenuForCategory(possibleCategoryUrl);
210215
}

0 commit comments

Comments
 (0)