ItemService
This service class contains functions related to common item tasks.
All public functions are available in the Twig template renderer.
Namespace
IO\Services
Type | Name | Description |
---|---|---|
|
||
|
||
|
SessionStorageRepositoryContract |
|
|
||
|
Methods
public __construct($app, $itemRepository, $sessionStorageRepository)
ItemService constructor.
Type |
Name |
Description |
|
||
|
||
|
public getItem($itemId):array
Get an item by ID
Type |
Name |
Description |
|
An item id |
public getItems($itemIds):array
Get a list of items with the specified item ids
Type |
Name |
Description |
|
List of item ids |
public getItemImage($itemId):string
Type |
Name |
Description |
|
An item id |
public getVariation($variationId):array
Get an item variation by id
Type |
Name |
Description |
|
An variation id |
public getVariations($variationIds):array
Get a list of item variations with the specified variation ids
Type |
Name |
Description |
|
A list of variation idss |
public getVariationIds($itemId):array
Get a list of active and salable variation ids associated with an item
Type |
Name |
Description |
|
An item id |
public getVariationList($itemId, $withPrimary = false):array
Get a list of variation ids associated with a specific item
Type |
Name |
Description |
|
An item id |
|
|
Optional: If true, load base variation too (Default: false) |
public getVariationImage($variationId, $imageAccessor = "urlPreview"):string
Deprecated!
This method will not be supported in the future. Please refrain from using it as soon as possible. |
Get image url of a variation
Type |
Name |
Description |
|
An variation id |
|
|
Optional: Key to image (Default: 'urlPreview') |
public getItemForCategory($catID, $params = [], $page = 1):array
Get all items for a specific category
Type |
Name |
Description |
|
A category id |
|
|
Optional: Parameters for Elastic Search, only itemsPerPage is used |
|
|
Optional: What page to get (Default: 1) |
public getVariationAttributeMap($itemId):array
List the attributes of an item variation
Type |
Name |
Description |
|
Optional: An item id |
public getVariationIsSalable($variationId):bool
Check, if variation is salable, meaning it has stock, has a price etc.
Type |
Name |
Description |
|
Optional: A variation id |
public getAttributeNameMap($itemId):array
Get a list containing attributes and units related to an item
Type |
Name |
Description |
|
Optional: An item id |
public getItemURL($itemId):Record
Deprecated!
Use UrlService instead |
Get the item URL
Type |
Name |
Description |
|
An item id |
public getAttributeName($attributeId):string
Get the name of an attribute by id
Type |
Name |
Description |
|
Optional: An attribute id |
public getAttributeValueName($attributeValueId):string
Get the name of an attribute value by id
Type |
Name |
Description |
|
Optional: An attribute value’s id |
public getItemCrossSellingList($itemId, $crossSellingType = "similar"):array
Get a list of cross-selling items for the specified item id
Type |
Name |
Description |
|
Optional: An item’s id |
|
|
Optional: The cross selling type (Default: 'similar') |
public getItemConditionText($conditionId):string
Get the text for a specific item condition
Type |
Name |
Description |
|
An item condition’s id |
public getLatestItems($limit = 5, $categoryId):RecordList
Get a list of the latest items
Type |
Name |
Description |
|
Optional: Maximum number of returned items (Default: 5) |
|
|
Optional: From which category should items be returned? |
public searchItems($searchString, $params = [], $page = 1):array
Search for items using a search string and return a result
Type |
Name |
Description |
|
A user inputted search string |
|
|
Optional: Parameters for elastic search query, only itemsPerPage is used |
|
|
Optional: Page number for pagination |
public getAdditionalItemSorting():array
Get additional sortings
public addAdditionalItemSorting($key, $translationKey)
Add an additional sorting
Type |
Name |
Description |
|
A sorting key |
|
|
The translation key for the sorting |
public fromMemoryCache()
public resetMemoryCache($key = null)
Type |
Name |
Description |
|