Wiki

Clone wiki

responsive-base / documentation / dynamic-urls

Dynamic URL's

From february 2017 and onwards Jetshop will use a new JS-object to determine URL's to system resources like login, site root, checkout and my pages.

This means that a developer cannot simply link to "/" or "/login", we need to use the JS objects for this.

The URL data origins from JetshopData.Urls, however there are pages in the system that lacks the emitter for JetshopData, so all handling of dynamic URL's are defaulted to .config.urls

Examples

J.config.urls.CountryRootUrl will hold the path to site root (most likely "/", but can also be outputted as "/se/")

J.config.urls.LoginUrl will hold the path to the login page (most likely "/login", but can also be outputted as "/se/login")

Handlebars helper

There is a helper for outputting values from J.config.

The helper will accept both single and double values like "apiCachePrefix" (J.config.apiCachePrefix) and "urls.CheckoutUrl" (J.config.urls.CheckoutUrl)

Inside a Handlebars view {{ config "urls.CheckoutUrl" }} will be expanded to "/checkout" in outputted HTML.

Handlebars example

<a href="{{ config "urls.CheckoutUrl" }}">To checkout</a>

Will be outputted as

<a href="/checkout">To checkout</a>

Affected base URL's

/
/login
/checkout
/Services
/my-pages
/signup
/signout
/kopvillkor

Complete list

    urls: {
        "CountryRootUrl": "/",
        "CheckoutUrl": "/checkout",
        "StageCheckoutUrl": "/stage/checkout",
        "ServicesUrl": "/Services",
        "CartServicesUrl": "/Services/CartInfoService.asmx/LoadCartInfo",
        "MyPagesUrl": "/my-pages",
        "StageMyPagesUrl": "/stage/my-pages",
        "LoginUrl": "/login",
        "StageLoginUrl": "/stage/login",
        "SignupUrl": "/signup",
        "SignoutUrl": "/signout",
        "MyPagesOrdersUrl": "/my-pages/orders",
        "MyPagesOrderdetailsUrl": "/my-pages/orderdetails",
        "MyPagesSettingsUrl": "/my-pages/settings",
        "TermsAndConditionsUrl": "/kopvillkor"
    }

Updated