\GravityItem

An item is something that can be recommended to users.

Summary

Methods
Properties
Constants
__construct()
$itemId
$title
$itemType
$hidden
$fromDate
$toDate
$nameValues
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$itemId

$itemId : string

The itemId is a unique identifier of the item.

Strings in the PHP client are always UTF-8 encoded.

Type

string

$title

$title : string

The item title. This is a short, human-readable name of the item.

If the title is available in multiple languages, try to use your system's primary language, for example English. Strings in the PHP client are always UTF-8 encoded.

Type

string

$itemType

$itemType : string

The type of the item. It can be used to create different item families.

The purpose of itemtype is to differentiate items which will have different namevalue properties. Examples:

  • Book
  • Ticket
  • Computer
  • Food

Type

string

$hidden

$hidden : boolean

The value of hidden. A hidden item will be never recommended.

Type

boolean

$fromDate

$fromDate : integer

An item is never recommended before this date.

The date in unixtime format, the number of seconds elapsed since 1970.01.01 00:00:00 UTC, as returned by the standard time() PHP function. Set it to 0 if not important.

Type

integer

$toDate

$toDate : integer

An item is never recommended after this date.

The date in unixtime format, the number of seconds elapsed since 1970.01.01 00:00:00 UTC, as returned by the standard time() PHP function. Set it to a big number (eg. 2147483647) if not important.

Type

integer

$nameValues

$nameValues : array<mixed,\GravityNameValue>

The NameValues for the item.

NameValues provide additional description of the item.

There can multiple NameValues with the same name.

The order of NameValues among different names will not be preserved, but the order of the values for the same name will be preserved.

The recommendation engine can be configured to use some properties to create a relation between items.

A possible list of names:

NameLocalizableDescription
TitleYesThe title of the item.
DescriptionYesThe description of item.
CategoryPathNoThe full path of the item's category. For example, CategoryPath might be "books/computers/databases" for a book about databases. CategoryPath can be repeated if an item belongs to multiple categories. Use "/" only for separating levels. Later it is possible to use the recommendation engine to filter the list of items based on category, so it can provide recommendations for "Computer Books" category or only for "Computer Books > Database" category.
TagsNoTags for the item. Specify a separate namevalue for each tag.
StateNoThe state of the item, for example 'available', 'out of stock' etc.
PriceNoThe price of the item.

The recommendation engine can accept arbitrary namevalues, the list above is just an example of basic properties that are used almost everywhere. The NameValues which are relevant to business rules and possible content based filtering should be provided to the recommendation engine.

You can use localization by appending a language identifier to the Name of the NameValue. For example, Title_EN, Title_HU. It is possible to use both non-localized and localized version.

Type

array<mixed,\GravityNameValue>

Methods

__construct()

__construct()