CategoryService

Namespace

IO\Services

Properties
Type Name Description

CategoryRepositoryContract

$categoryRepository

WebstoreConfigurationService

$webstoreConfig

SessionStorageService

$sessionStorageService

Category

$currentCategory

array

$currentCategoryTree

``

$authGuard

``

$currentItem

int

$webstoreId

``

$cache

Methods
public __construct($category)

CategoryService constructor.

Parameters

Type

Name

Description

CategoryRepositoryContract

$category

public setCurrentCategoryID($catID)

Set the current category by ID.

Parameters

Type

Name

Description

int

$catID

The id of the current category

public setCurrentCategory($cat)

Set the current category by ID.

Parameters

Type

Name

Description

Category

$cat

The current category

public getCurrentCategory():Category
public get($catID, $lang = null):Category

Get a category by ID

Parameters

Type

Name

Description

int

$catID

The category ID

string

$lang

The language to get the category

public getForPlentyId()
public getCurrentCategoryChildren()
public getURL($category, $lang = null, $):string

Return the URL for a given category ID.

Parameters

Type

Name

Description

Category

$category

the category to get the URL for

string

$lang

the language to get the URL for

int

$

public getURLById()
public isCurrent($category):bool

Check whether a category is referenced by the current route

Parameters

Type

Name

Description

mixed

$category

The category to check

public isOpen($category):bool

Check whether any child of a category is referenced by the current route

Parameters

Type

Name

Description

mixed

$category

The category to check

public isActive($category = null):bool

Check whether a category or any of its children is referenced by the current route

Parameters

Type

Name

Description

mixed

$category

The category to check

public getItems($category = null, $params = [], $page = 1): PaginatedResult
Parameters

Type

Name

Description

Category

$category

array

$params

int

$page

public getNavigationTree($type = [], $lang = null, $maxLevel = 2, $customerClassId):array

Return the sitemap tree as an array

Parameters

Type

Name

Description

string | array

$type

Only return categories of given types

string

$lang

The language to get sitemap tree for

int

$maxLevel

The deepest category level to load

int

$customerClassId

The customer class id to get tree

public getPartialTree()
public getNavigationList($type = [], $lang = null):array

Return the sitemap list as an array

Parameters

Type

Name

Description

string | array

$type

Only return categories of given type

string

$lang

The language to get sitemap list for

public getHierarchy($catID, $bottomUp = false, $filterCategories = false):array

Returns a list of all parent categories including given category

Parameters

Type

Name

Description

int

$catID

The category Id to get the parents for or 0 to use current category

bool

$bottomUp

Set true to order result from bottom (deepest category) to top (= level 1)

bool

$filterCategories

Filter categories

public isVisibleForWebstore()
public setCurrentItem($item)
Parameters

Type

Name

Description

``

$item

public getCurrentItem()
public isHidden($id)
Parameters

Type

Name

Description

``

$id

public fromMemoryCache()
public resetMemoryCache($key = null)
Parameters

Type

Name

Description

``

$key