Documentation

EsiWidgetController extends EsiWidgetController
in package

Render the products widget

Tags
copyright

Cloudrexx AG

author

Michael Ritter michael.ritter@cloudrexx.com

subpackage

module_shop

Table of Contents

Properties

$cx  : Cx
Main class instance
$esiParamPage  : Page
Holds

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
Creates new controller
getAccessableMethods()  : array<string|int, mixed>
Returns an array of method names accessable from a JSON request
getDefaultPermissions()  : Permission
Returns default permission as object
getMessagesAsString()  : string
Returns all messages as string
getName()  : string
Returns the internal name used as identifier for this adapter
getSystemComponentController()  : SystemComponentController
Returns the main controller
getWidget()  : array<string|int, mixed>
Returns the content of a widget
parseWidget()  : mixed
Parses a widget
initCheckout()  : void
Initializes the Shop and checkout state for a checkout widget.
internalParseWidget()  : array<string|int, mixed>
Parses a widget
loadTemplateOfWidget()  : Sigma|null
Loads and prepares the Sigma template of a Shop ESI widget.
objectifyParams()  : array<string|int, mixed>
This makes object of the given params (if possible) Known params are page, lang, user, theme, channel, country, currency and ref
parseWidgetShopCheckoutAccount()  : string
Renders the func_shop_checkout_account widget.
parseWidgetShopCheckoutCart()  : string
Renders the func_shop_checkout_cart widget.
parseWidgetShopCheckoutPayment()  : string
Renders the func_shop_checkout_payment widget.
parseWidgetShopProduct()  : string
Renders the func_shop_product widget.

Properties

Methods

__call()

Route methods like getName(), getType(), getDirectory(), etc.

public __call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
$methodName : string

Name of method to call

$arguments : array<string|int, mixed>

List of arguments for the method to call

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

getWidget()

Returns the content of a widget

public getWidget(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

JsonAdapter parameters

Return values
array<string|int, mixed>

Content in an associative array

parseWidget()

Parses a widget

public parseWidget(mixed $name, mixed $template, mixed $response, mixed $params) : mixed
Parameters
$name : mixed

Widget name

$template : mixed
$response : mixed

Current response

$params : mixed

Array of params

Tags
inheritdoc

initCheckout()

Initializes the Shop and checkout state for a checkout widget.

protected initCheckout(Sigma $template[, array<string|int, mixed> $post = [] ]) : void

Boots Shop::init() in remote (ESI) mode, runs Shop::initializeCheckout() and sets the global currency placeholders on the widget template.

Parameters
$template : Sigma

The checkout widget template to populate with the global currency placeholders

$post : array<string|int, mixed> = []

The request parameters to initialize the checkout with

internalParseWidget()

Parses a widget

protected internalParseWidget(Widget $widget, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$widget : Widget

The Widget

$params : array<string|int, mixed>

Params passed by ESI (/API) request

Return values
array<string|int, mixed>

Content in an associative array

loadTemplateOfWidget()

Loads and prepares the Sigma template of a Shop ESI widget.

protected loadTemplateOfWidget(string $template, string $name, array<string|int, mixed> $params, Response $response) : Sigma|null

Resolves the widget's template file within the current theme (falling back to the "Default" template), runs the legacy Block and Node parsing over its contents and wraps the result in a Sigma instance.

Parameters
$template : string

The template name; sanitized, defaults to "Default"

$name : string

The widget name (used to resolve the template folder)

$params : array<string|int, mixed>

Widget parameters; expects a theme entry used to resolve the template file

$response : Response

The current response, whose page is used while parsing legacy blocks

Return values
Sigma|null

The prepared template, or null if the template file does not exist

objectifyParams()

This makes object of the given params (if possible) Known params are page, lang, user, theme, channel, country, currency and ref

protected objectifyParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Associative array of params

Return values
array<string|int, mixed>

Associative array of params

parseWidgetShopCheckoutAccount()

Renders the func_shop_checkout_account widget.

protected parseWidgetShopCheckoutAccount(string $name, array<string|int, mixed> $params, Response $response) : string

Resolves the widget template, initializes the checkout and renders the account step via Shop::view_account().

Parameters
$name : string

The widget name (used to resolve the template folder)

$params : array<string|int, mixed>

Widget parameters (numeric template parameters)

$response : Response

Response object, also used to read the request parameters

Return values
string

Rendered widget content, or an empty string if no template

parseWidgetShopCheckoutCart()

Renders the func_shop_checkout_cart widget.

protected parseWidgetShopCheckoutCart(string $name, array<string|int, mixed> $params, Response $response) : string

Resolves the widget template, initializes the checkout and renders the cart step via Shop::cart().

Parameters
$name : string

The widget name (used to resolve the template folder)

$params : array<string|int, mixed>

Widget parameters (numeric template parameters)

$response : Response

Response object, also used to read the request parameters

Return values
string

Rendered widget content, or an empty string if no template

parseWidgetShopCheckoutPayment()

Renders the func_shop_checkout_payment widget.

protected parseWidgetShopCheckoutPayment(string $name, array<string|int, mixed> $params, Response $response) : string

Resolves the widget template, initializes the checkout and renders the payment step via Shop::payment().

Parameters
$name : string

The widget name (used to resolve the template folder)

$params : array<string|int, mixed>

Widget parameters (numeric template parameters)

$response : Response

Response object, also used to read the request parameters

Return values
string

Rendered widget content, or an empty string if no template

parseWidgetShopProduct()

Renders the func_shop_product widget.

protected parseWidgetShopProduct(string $name, array<string|int, mixed> $params, Response $response) : string

This method resolves the widget template file, parses category and product filter parameters, then delegates the rendering to Shop::parseProduct().

Behavior:

  • Determines the widget template name from $params[0], sanitized, defaulting to "Default".
  • Loads the widget template file and wraps it in a Sigma instance.
  • Calls Shop::parseProduct() to populate the template with product entries.
  • Returns the rendered template content, or an empty string if no template or no products matched.
Parameters
$name : string

The widget name (used to resolve the template folder).

$params : array<string|int, mixed>

Widget parameters, including:

  • theme: Theme instance to resolve template files.
  • user: Session ID if user is signed in.
  • 0: (optional) Template name (defaults to "Default").
  • 1: (optional) Category ID.
  • 2: (optional) Product ID.
$response : Response

Response object, updated with expiration date if needed.

Return values
string

Rendered widget content, or an empty string if no products are found.

On this page

Search results