Documentation

ShopCategories
in package

Tags
copyright

Cloudrexx AG

author

Cloudrexx AG info@cloudrexx.com

subpackage

module_shop

Table of Contents

Properties

$arrCategory  : array<string|int, mixed>
ShopCategory Tree array
$arrTrail  : array<string|int, mixed>
The trail from the root (0, zero) to the selected ShopCategory.

Methods

buildTrailArray()  : mixed
Build the ShopCategories ID trail array.
buildTreeArray()  : bool
Builds the $arrCategory array as returned by {@link ShopCategories::getTreeArray()}, representing a tree of ShopCategories, not including the root chosen.
buildTreeArrayRecursive()  : bool
Recursively builds the $arrCategory array as returned by {@link ShopCategories::getTreeArray()}.
deleteAll()  : bool
Delete all ShopCategories from the database.
deleteById()  : bool
Deletes the Category with the given ID
getArrayById()  : array<string|int, mixed>
Returns the array of ShopCategory data for the given ID.
getAssignedShopCategoriesMenuoptions()  : string
Returns the HTML code for options of two separate menus of available and assigned ShopCategories.
getByWildcard()  : array<string|int, mixed>
Select an array of ShopCategories matching the wildcards from the database.
getChildCategoriesById()  : array<string|int, mixed>
Returns an array of children of the ShopCategories with ID $parent_id.
getChildCategoryIdArray()  : array<string|int, mixed>
Returns an array of IDs of children of this ShopCategory.
getChildNamed()  : mixed
Returns the ShopCategory with the given parent ID and the given name, if found.
getMenu()  : string
Returns the HTML code for a dropdown menu listing all ShopCategories.
getMenuoptions()  : string
Returns the HTML code for a dropdown menu listing all ShopCategories.
getNameArray()  : array<string|int, mixed>
Returns an array of Category names indexed by their respective IDs
getNextShopCategoriesId()  : int
Get the next ShopCategories ID after $shopCategoryId according to the sorting order.
getParentCategoryId()  : mixed
Returns the parent category ID of the ShopCategory specified by its ID,
getPictureById()  : string
Returns the best match for the Category Image
getSearchCategoryIdString()  : string
Returns a string listing all ShopCategory IDs contained within the subtree starting with the ShopCategory with ID $parent_id.
getTrailArray()  : mixed
Returns the ShopCategories ID trail array.
getTreeArray()  : array<string|int, mixed>
Returns an array representing a tree of ShopCategories, not including the root chosen.
getTreeNodeCount()  : mixed
Returns the number of elements in the ShopCategory array of this object.
getVirtualCategoriesSelectionForFlags()  : string
Returns a string with HTML code to display the virtual ShopCategory selection checkboxes.
getVirtualCategoryIdNameArray()  : array<string|int, mixed>
Returns an array with the IDs and names of all ShopCategories marked as virtual.
getVirtualCategoryNameArray()  : array<string|int, mixed>
Returns an array with the names of all ShopCategories marked as virtual.
invalidateTreeArray()  : mixed
Invalidate the current state of the arrShopCategory array and its index.
makeThumbnailById()  : string
Create thumbnail and update the corresponding ShopCategory records
toggleStatusById()  : bool
Toggles the Category status for the given ID

Properties

$arrCategory

ShopCategory Tree array

private static array<string|int, mixed> $arrCategory = null
Tags
access

private

$arrTrail

The trail from the root (0, zero) to the selected ShopCategory.

private static array<string|int, mixed> $arrTrail = null

See for details.

Methods

buildTrailArray()

Build the ShopCategories ID trail array.

public static buildTrailArray(int $shopCategoryId) : mixed

Sets up an array of ShopCategories IDs of the $shopCategoryId, and all its ancestors.

Parameters
$shopCategoryId : int

The ShopCategories ID

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
mixed

The array of all ancestor ShopCategories on success, false otherwise.

buildTreeArray()

Builds the $arrCategory array as returned by {@link ShopCategories::getTreeArray()}, representing a tree of ShopCategories, not including the root chosen.

public static buildTreeArray([bool $flagFull = false ][, bool $active = true ][, bool $flagVirtual = true ][, int $selected_id = 0 ][, int $parent_id = 0 ][, int $maxlevel = 0 ]) : bool

The resulting array looks like: array( 'id => ShopCategory ID 'name' => Category name, 'shortDescription' => Category short description, 'description' => Category description, 'parent_id' => parent ID 'ord' => order value, 'active' => active flag (boolean), 'picture' => 'picture name', 'flags' => 'Category flags' (string), 'virtual' => virtual flag status (boolean), 'level' => nesting level, ), ... more parents Note that this includes the virtual ShopCategories and their children.

Parameters
$flagFull : bool = false

If true, the full tree is built, only the parts visible for $selected_id otherwise. Defaults to false.

$active : bool = true

Only return ShopCategories with active == true if true. Defaults to true.

$flagVirtual : bool = true

If true, also returns the virtual content of ShopCategories marked as virtual. Defaults to false.

$selected_id : int = 0

The optional selected ShopCategory ID. If set and greater than zero, only the ShopCategories needed to display the Shop page are returned.

$parent_id : int = 0

The optional root ShopCategories ID. Defaults to 0 (zero).

$maxlevel : int = 0

The optional maximum nesting level. 0 (zero) means all. Defaults to 0 (zero).

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise.

buildTreeArrayRecursive()

Recursively builds the $arrCategory array as returned by {@link ShopCategories::getTreeArray()}.

public static buildTreeArrayRecursive([bool $flagFull = false ][, bool $active = true ][, bool $flagVirtual = true ][, int $selected_id = 0 ][, int $parent_id = 0 ][, int $maxlevel = 0 ][, int $level = 0 ]) : bool

See for details.

Parameters
$flagFull : bool = false

If true, the full tree is built, only the parts visible for $selected_id otherwise. Defaults to false.

$active : bool = true

Only return ShopCategories with active == true if true. Defaults to true.

$flagVirtual : bool = true

If true, also returns the virtual content of ShopCategories marked as virtual. Defaults to false.

$selected_id : int = 0

The optional selected ShopCategory ID. If set and greater than zero, only the ShopCategories needed to display the Shop page are returned.

$parent_id : int = 0

The optional root ShopCategories ID. Defaults to 0 (zero).

$maxlevel : int = 0

The optional maximum nesting level. 0 (zero) means all. Defaults to 0 (zero).

$level : int = 0

The optional nesting level, initially 0. Defaults to 0 (zero).

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise.

deleteAll()

Delete all ShopCategories from the database.

public static deleteAll([bool $flagDeleteImages = false ]) : bool

Also removes associated subcategories and Products. Images will only be erased from the disc if the optional $flagDeleteImages parameter evaluates to true.

Parameters
$flagDeleteImages : bool = false

Delete associated image files if true. Defaults to false

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

deleteById()

Deletes the Category with the given ID

public static deleteById(int $id[, mixed $flagDeleteImages = false ]) : bool

Does not delete subcategories nor pictures. Use delete() for that. If the Category doesn't exist to begin with, returns null.

Parameters
$id : int

The ShopCategory ID

$flagDeleteImages : mixed = false
Return values
bool

True on success, false on failure, or null otherwise

getArrayById()

Returns the array of ShopCategory data for the given ID.

public static getArrayById(int $id) : array<string|int, mixed>

If the ShopCategory array is not initialized, or if an invalid ID is provided, returns null.

Parameters
$id : int

The ShopCategory ID

Tags
static
author

Reto Kohli reto.kohli@comvation.com

Return values
array<string|int, mixed>

The ShopCategory data array on success, null otherwise

getAssignedShopCategoriesMenuoptions()

Returns the HTML code for options of two separate menus of available and assigned ShopCategories.

public static getAssignedShopCategoriesMenuoptions([string $assigned_category_ids = null ]) : string

The tag pair with the menu name will be included, plus an option for the root ShopCategory.

Parameters
$selected_id : int = 0

The selected ShopCategories ID

$name : string = 'catId'

The optional menu name, defaults to 'catId'.

$active : mixed = true
Tags
global

array

static
author

Reto Kohli reto.kohli@comvation.com

Return values
string

The HTML dropdown menu code

getMenuoptions()

Returns the HTML code for a dropdown menu listing all ShopCategories.

public static getMenuoptions([int $selected_id = 0 ][, bool $active = true ][, int $maxlevel = 0 ][, bool $include_none = false ]) : string

The