UrlService

This service class contains functions related to url generation etc.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Properties
Type Name Description

WebstoreConfigurationRepositoryContract

$webstoreConfigurationRepository

``

$cache

Methods
public __construct($webstoreConfigurationRepository)

UrlService constructor.

Parameters

Type

Name

Description

WebstoreConfigurationRepositoryContract

$webstoreConfigurationRepository

public getCategoryURL($categoryId, $lang = null, $webstoreId = null):UrlQuery

Get canonical URL for a category

Parameters

Type

Name

Description

int

$categoryId

A category id to get the URL for

string

$lang

Optional: A language for the URL (ISO-639-1) (Default: The current language)

int

$webstoreId

Optional: A webstore id (Default: The current webstore id)

public getVariationURL($itemId, $variationId, $lang = null):UrlQuery

Get canonical URL for a variation

Parameters

Type

Name

Description

int

$itemId

An item id to get URL for

int

$variationId

An variation id to get URL for

string

$lang

Optional: A language to get URL for (ISO-639-1) (Default: The current language)

public getCanonicalURL($lang = null, $ignoreCanonical = false):string

Get canonical URL for current page

Parameters

Type

Name

Description

string

$lang

Optional: Language for the URL

bool

$ignoreCanonical

Optional: If true, get canonical from category details (Default: false)

public getCanonicalQueryString():string

Get query string from URI, return an empty string if its an canonical link from category details

public isCanonical($lang = null):bool

Check if the current URL is canonical

Parameters

Type

Name

Description

string

$lang

Optional: A language for the check (Default: The current language)

public getLanguageURLs():array

Get equivalent canonical URLs for each active language

public getHomepageURL():string
Deprecated!

since 4.3.0 Use IO\Extensions\Constants\ShopUrls::$home instead.

Get language specific homepage URL

public redirectTo($redirectURL):mixed

Redirects to the given URL

Parameters

Type

Name

Description

string

$redirectURL

public isRouteEnabled($route):bool

Check if route is enabled or category is linked to route.

Parameters

Type

Name

Description

string

$route

public fromMemoryCache()
public resetMemoryCache($key = null)
Parameters

Type

Name

Description

``

$key