\GravityRecommendationContext

Contains information for a recommendation request.

Summary

Methods
Properties
Constants
__construct()
$recommendationTime
$numberLimit
$scenarioId
$nameValues
$resultNameValues
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$recommendationTime

$recommendationTime : integer

The time of the recommendation (seconds in unixtime format), the time when it will be shown to the end user.

Use a value as returned by the standard time() PHP function.

Type

integer

$numberLimit

$numberLimit : integer

The value of the maximum number of items in the result.

The maximum number of the items in the result can be also limited by the configuration of the scenario. If set to 0, this number of items is determined by the scenario.

Type

integer

$scenarioId

$scenarioId : string

The value of scenarioId. Scenarios are defined by the scenario management API.

A scenario describes a way how recommended items will be filtered, ordered.

Type

string

$nameValues

$nameValues : array<mixed,\GravityNameValue>

The NameValues for the context.

NameValues can describe the parameters for the actual scenario, like current item id, filtering by category etc. Item-to-item recommendation is possible by a specific scenario which parses a NameValue describing the current item, or multiple NameValues if there are multiple actual items. The list of allowed names depends on the actual scenario.

The scenario can also specify that the result is not a list of items, but a list of values of item NameValues.

NameDescription
CurrentItemIdThe identifier of the actual item, if the current page is an item page.
ItemOnPageIdentifier of item displayed elsewhere on the page. They will be excluded from recommendation. This namevalue can be used multiple times to provide a list of items.
CartItemIdIdentifier of item in the current shopping cart. This can provide additional information to improve the quality of recommendation. This namevalue must be used as many times as many items the shopping cart contains.
CartItemQuantityThe quantity of items in the current shopping cart, in the same order as CartItemId namevalues.
Filter.*If specified, only items having the specified name and value as metadata will be in the result. For example, the namevalue with name='Filter'.'CategoryId' and value='A' means that only items belonging to category 'A' will be in the result.

Type

array<mixed,\GravityNameValue>

$resultNameValues

$resultNameValues : array<mixed,\GravityNameValue>

If not null, specifies which NameValues of the recommended items should be included in the result.

If null, the returned NameValues are determined by the actual scenario.

Type

array<mixed,\GravityNameValue>

Methods

__construct()

__construct()