Documentation

Manufacturer
in package

Manufacturer

Tags
version
3.0.0
subpackage

module_shop

copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Reto Kohli reto.kohli@comvation.com

Table of Contents

Constants

TEXT_NAME  : mixed = 'manufacturer_name'
Text keys
TEXT_URI  : mixed = 'manufacturer_uri'

Properties

$arrManufacturer  : array<string|int, mixed>
Static class data with the manufacturers

Methods

delete()  : bool
Deletes one or more Manufacturers
errorHandler()  : bool
Handles database errors
flush()  : void
Flushes the static data from the class
getArray()  : array<string|int, mixed>
Returns an array of Manufacturers
getMenu()  : string
Get the Manufacturer dropdown menu HTML code string.
getMenuoptions()  : string
Returns the Manufacturer HTML dropdown menu options code
getNameArray()  : array<string|int, mixed>
Returns the array of Manufacturer names
getNameById()  : string
Returns the name of the Manufacturer with the given ID
getUrlById()  : string
Returns the URL of the Manufacturers for the given ID
init()  : bool
Initialise the Manufacturer array
insert()  : bool
Inserts a new Manufacturer
record_exists()  : bool
Returns true if a Manufacturer for the given ID exists in the database
store()  : bool
Stores a Manufacturer
update()  : bool
Updates an existing Manufacturer

Constants

Properties

$arrManufacturer

Static class data with the manufacturers

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

Methods

delete()

Deletes one or more Manufacturers

public static delete(mixed $ids) : bool
Parameters
$ids : mixed

The Manufacturer ID or an array of those

Tags
static
Return values
bool —

True on success, false otherwise

errorHandler()

Handles database errors

public static errorHandler() : bool

Also migrates the old Manufacturers to the new structure

Tags
throws
Update_DatabaseException
Return values
bool —

False. Always.

flush()

Flushes the static data from the class

public static flush() : void

Call this after the database has been modified, before you access the Manufacturer array again.

Tags
static

getArray()

Returns an array of Manufacturers

public static getArray(int &$count[, string $order = null ][, int $offset = 0 ][, int $limit = null ]) : array<string|int, mixed>

The $filter parameter is unused, as this functionality is not implemented yet. Note that you SHOULD re-init() the array after changing the database table. See for details on the array.

Parameters
$count : int

The count, by reference

$order : string = null

The optional sorting order. Defaults to null

$offset : int = 0

The optional record offset. Defaults to 0 (zero)

$limit : int = null

The optional record count limit Defaults to null (all records)

Tags
todo

Implement the filter

Return values
array<string|int, mixed> —

The Manufacturer array on success, null otherwise //@param array $filter NOT IMPLEMENTED: The optional filter array. // Defaults to null

getMenu()

Get the Manufacturer dropdown menu HTML code string.

public static getMenu([string $menu_name = 'manufacturerId' ][, int $selected_id = 0 ][, bool $include_none = false ]) : string

Used in the Product search form, see .

Parameters
$menu_name : string = 'manufacturerId'

The optional menu name. Defaults to manufacturer_id

$selected_id : int = 0

The optional preselected Manufacturer ID

$include_none : bool = false

If true, a dummy option for "none" is included at the top

Tags
static
global

ADONewConnection

array

Return values
string —

The Manufacturer dropdown menu HTML code

getMenuoptions()

Returns the Manufacturer HTML dropdown menu options code

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

Used in the Product search form, see .

Parameters
$selected_id : int = 0

The optional preselected Manufacturer ID

$include_none : bool = false

If true, a dummy option for "none" is included at the top

Tags
static
global

ADONewConnection $objDatabase

Return values
string —

The Manufacturer dropdown menu options

getNameArray()

Returns the array of Manufacturer names

public static getNameArray() : array<string|int, mixed>

Call this only after updating the database, or the static array in here will be outdated. database table.

Return values
array<string|int, mixed> —

The Manufacturer name array

getNameById()

Returns the name of the Manufacturer with the given ID

public static getNameById(int $id) : string
Parameters
$id : int

The Manufacturer ID

Tags
static
global

ADONewConnection

todo

Move this to the Manufacturer class!

Return values
string —

The Manufacturer name on success, or the empty string on failure

getUrlById()

Returns the URL of the Manufacturers for the given ID

public static getUrlById(int $id) : string
Parameters
$id : int

The Manufacturer ID

Tags
static
global

ADONewConnection

todo

Move this to the Manufacturer class!

Return values
string —

The Manufacturer URL on success, or the empty string on failure

init()

Initialise the Manufacturer array

public static init([string $order = null ][, int $localeId = 0 ]) : bool

If $localeId is not set, then the FRONTEND_LANG_ID constant is used to determine the locale. The array has the form array( 'id' => Manufacturer ID, 'name' => Manufacturer name, 'url' => Manufacturer URI, )

Parameters
$order : string = null

The optional sorting order. Defaults to null (unsorted)

$localeId : int = 0

Optional locale ID. If not set FRONTEND_LANG_ID will be used.

Tags
static
global

ADONewConnection $objDatabase

array $_ARRAYLANG

todo

Order the Manufacturers by their name

Return values
bool —

True on success, false otherwise

insert()

Inserts a new Manufacturer

public static insert(string $name, string $url[, int $localeId = 0 ]) : bool
Parameters
$name : string

The Manufacturer name

$url : string

The Manufacturer URL

$localeId : int = 0

Optional locale ID. If not set FRONTEND_LANG_ID will be used.

Tags
static
Return values
bool —

True on success, false otherwise

record_exists()

Returns true if a Manufacturer for the given ID exists in the database

public static record_exists(int $id) : bool

If the ID is empty or invalid, or cannot be found in the table, returns false. Returns true on failure (assumes that it exists).

Parameters
$id : int

The Manufacturer ID

Tags
static
Return values
bool —

False if the ID is not present already, true otherwise

store()

Stores a Manufacturer

public static store(string $name, string $url[, int $id = null ][, int $localeId = 0 ]) : bool
Parameters
$name : string

The Manufacturer name

$url : string

The Manufacturer URL

$id : int = null

The optional Manufacturer ID

$localeId : int = 0

Optional locale ID

Tags
static
Return values
bool —

True on success, false otherwise

update()

Updates an existing Manufacturer

public static update(string $name, string $url, int $id[, int $localeId = 0 ]) : bool
Parameters
$name : string

The Manufacturer name

$url : string

The Manufacturer URL

$id : int

The Manufacturer ID

$localeId : int = 0

Optional locale ID. If not set FRONTEND_LANG_ID will be used.

Tags
static
throws
Update_DatabaseException
Return values
bool —

True on success, false otherwise

On this page

Search results