Skip to main content
page last edited on 10 October 2022

Routing

Version: 5.5

A request is first processed by symfony and, if no specific route has been found, the request is passed on to X-Cart for processing. If the prefix “admin/” is used in the URL, then the zone is set to Admin.

Keep in mind that controllers in symfony do not have access to all the functionality of X-Cart; speaking more precisely, some additional steps are required for work with X-Cart.

XCart uses non-standard routing. For controller selection, the request parameters target and action are used.

Based on the target parameter, an appropriate class is selected:

<XCart>/classes/XLite/Controller/{Zone}/{Target}.php

<XCart>/modules/{AuthorId}/{ModuleId}/src/Controller/{Zone}/{Target}.php

Zone - Admin or Customer - this is defined in the base controller \XCart\Controller\XCartController

Target - The value of the target request parameter is converted from snake_case to UpperCamelCase (PascalCase)

Based on the action parameter, a controller method is selected: doAction{Action}

If the action parameter is missing, the method doNoAction is used.

Action - The value of the action request parameter is converted from snake_case to UpperCamelCase (PascalCase)

Then, for ajax requests, if the request parameter widget has been specified, as a response, the respective widget will be rendered. Otherwise? the widget XLite\View\Controller will be rendered.