Skip to main content

Overview

OCI 5.0 supports function calls: requests where the procurement system not only logs in, but wants to perform a specific action — for example, validate a product directly, navigate to search results, or download the catalog as JSON.


OciFunctionDispatcher

The OciFunctionDispatcher is the central entry point. It receives the function parameter, normalises it with strtoupper(), and routes it via match to the appropriate controller:

// OciFunctionDispatcher::dispatch()
return match (strtoupper($function)) {
'DETAIL' => $this->ociDetailController->handle(...),
'VALIDATE' => $this->ociValidateController->handle(...),
'SOURCING' => $this->ociSourcingController->handle(...),
'BACKGROUND_SEARCH' => $this->ociBackgroundSearchController->handle(...),
'DOWNLOADJSON' => $this->ociDownloadJsonController->handle(...),
'QUANTITYCHECK' => $this->ociQuantityCheckController->handle(...),
default => $this->ociUndefinedFunctionController->handle($function, $params),
};

The function parameter is case-insensitive: detail, Detail, and DETAIL all route to the same controller.


Two SalesChannelContexts

All function controllers receive two separate SalesChannelContexts:

ParameterPurpose
$dataFeedContextProduct queries and DataField resolution; uses the data feed SalesChannel configured in the OCI system
$cartContextCart operations (adding products); uses the SalesChannel of the logged-in buyer

This separation allows, for example, different price groups: product data (and OCI field resolution) uses the data feed context, cart operations use the buyer context.


Supported functions

function valueController classRequired parametersResponse type
DETAILOciDetailControllerproductidRedirect to product detail page
VALIDATEOciValidateControllerproductid, quantityOCI form HTML
SOURCINGOciSourcingControllersearchstringRedirect to search results page
BACKGROUND_SEARCHOciBackgroundSearchControllersearchstringOCI form HTML
DOWNLOADJSONOciDownloadJsonControllerJSON product catalog
QUANTITYCHECKOciQuantityCheckControllerproductidJSON availability
(unknown)OciUndefinedFunctionControllerFlash message + redirect to home

Fallback: unknown functions

Unknown function values land in OciUndefinedFunctionController. It adds a flash warning and redirects to the Shopware home page:

OCI function "UNKNOWN_FUNCTION" is not supported.

Session behaviour

Not all functions keep the ConnectorSession alive:

FunctionSession after call
DETAILActive (buyer stays logged in)
SOURCINGActive (buyer stays logged in)
VALIDATECleared
BACKGROUND_SEARCHCleared
DOWNLOADJSONCleared
QUANTITYCHECKCleared