diff --git a/app/modules/core/static/merchant/js/init-alpine.js b/app/modules/core/static/merchant/js/init-alpine.js index 67d93920..8dc416ee 100644 --- a/app/modules/core/static/merchant/js/init-alpine.js +++ b/app/modules/core/static/merchant/js/init-alpine.js @@ -54,7 +54,11 @@ function data() { const segments = path.split('/').filter(Boolean); // For /merchants/dashboard -> 'dashboard' // For /merchants/billing/subscriptions -> 'subscriptions' - this.currentPage = segments[segments.length - 1] || 'dashboard'; + // For /merchants/billing/subscriptions/3 -> 'subscriptions' (skip numeric IDs) + const last = segments[segments.length - 1] || 'dashboard'; + this.currentPage = /^\d+$/.test(last) && segments.length > 2 + ? segments[segments.length - 2] + : last; // Load merchant name from JWT token const token = localStorage.getItem('merchant_token'); diff --git a/app/modules/core/static/store/js/init-alpine.js b/app/modules/core/static/store/js/init-alpine.js index 2d6150ff..1f52e3a9 100644 --- a/app/modules/core/static/store/js/init-alpine.js +++ b/app/modules/core/static/store/js/init-alpine.js @@ -58,7 +58,11 @@ function data() { // Set current page from URL const path = window.location.pathname; const segments = path.split('/').filter(Boolean); - this.currentPage = segments[segments.length - 1] || 'dashboard'; + // For /store/ABC/orders/123 -> 'orders' (skip numeric IDs) + const last = segments[segments.length - 1] || 'dashboard'; + this.currentPage = /^\d+$/.test(last) && segments.length > 2 + ? segments[segments.length - 2] + : last; // Get store code from URL if (segments[0] === 'store' && segments[1]) {