File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -214,16 +214,15 @@ define([
214
214
* Clears the active state if no valid category URL is found or if it's not a product page.
215
215
*
216
216
* @param {String } currentUrl - The current page URL without parameters.
217
- * @return { Boolean } - True if a valid category is set, false otherwise.
217
+ * @return void
218
218
* @private
219
219
*/
220
220
_setActiveMenuForProduct : function ( currentUrl ) {
221
221
var firstCategoryUrl = this . element . find ( '> li a' ) . attr ( 'href' ) ;
222
222
223
- // Return false if no category URL is found in the menu.
224
223
if ( ! firstCategoryUrl ) {
225
224
this . _clearActiveState ( ) ;
226
- return false ;
225
+ return ;
227
226
}
228
227
229
228
var categoryUrlExtension = this . _getUrlExtension ( firstCategoryUrl ) ;
@@ -233,22 +232,16 @@ define([
233
232
if ( isProductPage ) {
234
233
var currentHostname = window . location . hostname ;
235
234
236
- // Check if the referrer's hostname matches the current hostname
237
- // and if the referrer's pathname ends with the category URL extension
238
235
if ( document . referrer . includes ( currentHostname ) && document . referrer . endsWith ( categoryUrlExtension ) ) {
239
236
categoryUrl = document . referrer . split ( '?' ) [ 0 ] ;
240
237
} else {
241
- // Fallback to using the current URL
242
238
categoryUrl = currentUrl . substring ( 0 , currentUrl . lastIndexOf ( '/' ) ) + categoryUrlExtension ;
243
239
}
244
240
245
241
this . _setActiveMenuForCategory ( categoryUrl ) ;
246
- return true ;
242
+ } else {
243
+ this . _clearActiveState ( ) ;
247
244
}
248
-
249
- // Clear active state if not a product page
250
- this . _clearActiveState ( ) ;
251
- return false ;
252
245
} ,
253
246
254
247
/**
You can’t perform that action at this time.
0 commit comments