Skip to content

PromotionsUrl

The PromotionsUrl object extends the Url object. Represents a link to the list of products with special offer.

classDiagram
  direction LR
  PromotionsUrl <|-- Url
  class Url{
  }
  class PromotionsUrl{
    array params
    PromotionsUrl forPage(int page)
    PromotionsUrl forView(string view)
    PromotionsUrl forSort(int sort)
  }

Methods

url.forPage(int page)

Method returns PromotionsUrl object with the page parameter set in the url.

source
{{ url.forPage(10).relative }}
output
/pl/promotions/10

url.forView(string view)

Method returns PromotionsUrl object with the view parameter set in the url.

source
{{ url.forView(view-name) }}
output
/pl/promotions/1/view-name

url.forSort(int sort)

Method returns PromotionsUrl object with the sort parameter set in the url

source
{{ url.forSort(12).relative }}
output
/pl/promotions/1/default/12

Examples

Displaying absolute url with page parameter set:

source
{{ url.forPage(3).absolute }}
output
https://domain.com/pl/promotions/3

Displaying absolute url with view parameter set:

source
{{ url.forView(view-example).absolute }}
output
https://domain.com/pl/promotions/1/view-name

It is also possible to call these methods in chain and build an url with multiple parameters:

source
{{ url.forPage(2).forView(example-view).forSort(12).absolute }}
output
https://domain.com/pl/promotions/2/example-view/12