Zones
in package
Zones
Tags
Table of Contents
Constants
- TEXT_NAME = 'zone_name'
- Text key
Properties
- $arrRelation : array<string|int, mixed>
- Zone-Country relation
- $arrZone : array<string|int, mixed>
- Zones
Methods
- addZone() : mixed
- Add a new zone
- deleteZone() : mixed
- Delete Zone
- errorHandler() : bool
- Handles database errors
- getCountryRelationArray() : array<string|int, mixed>
- Returns the Zone-Country relation array
- getMenu() : string
- Returns HTML code for the Zones dropdown menu
- getNameArray() : array<string|int, mixed>
- Returns an array of Zone names indexed by their respective IDs
- getZoneArray() : array<string|int, mixed>
- Returns an array of the available zones
- getZoneIdByPaymentId() : int
- Returns the Zone ID associated with the given Payment ID, if any
- getZoneIdByShipperId() : int
- Returns the Zone ID for the given shipper ID
- init() : bool
- Initialises all Zones (but no relation)
- store_from_post() : bool
- Stores all changes made to any Zone
- update_shipper_relation() : bool
- Updates the relation entry for the given Shipper and Zone ID
- updateZones() : bool
- Updates the Zones with data posted from the form
Constants
TEXT_NAME
Text key
public
mixed
TEXT_NAME
= 'zone_name'
Properties
$arrRelation
Zone-Country relation
private
static array<string|int, mixed>
$arrRelation
= array()
$arrZone
Zones
private
static array<string|int, mixed>
$arrZone
= null
Methods
addZone()
Add a new zone
public
static addZone([int $localeId = 0 ]) : mixed
Parameters
- $localeId : int = 0
-
Optional locale ID. If not set FRONTEND_LANG_ID will be used.
Tags
deleteZone()
Delete Zone
public
static deleteZone() : mixed
Tags
errorHandler()
Handles database errors
public
static errorHandler() : bool
Also migrates text fields to the new structure
Tags
Return values
bool —False. Always.
getCountryRelationArray()
Returns the Zone-Country relation array
public
static getCountryRelationArray() : array<string|int, mixed>
This array is of the form array( Zone ID => array(Country ID, ... more ...), ... more ... )
Tags
Return values
array<string|int, mixed> —The relation array
getMenu()
Returns HTML code for the Zones dropdown menu
public
static getMenu([int $selected = 0 ][, string $name = 'zone_id' ][, string $onchange = '' ]) : string
Includes all Zones. Backend use only.
Parameters
- $selected : int = 0
-
The optional preselected Zone ID. Defaults to 0 (zero)
- $name : string = 'zone_id'
-
The optional name attribute value. Defaults to "zone_id".
- $onchange : string = ''
-
The optional onchange attribute value. Defaults to the empty string
Return values
string —The HTML dropdown menu code
getNameArray()
Returns an array of Zone names indexed by their respective IDs
public
static getNameArray([bool $active = null ]) : array<string|int, mixed>
Parameters
- $active : bool = null
-
Optionally limits results to Zones of the given active status if set. Defaults to null
Return values
array<string|int, mixed> —The array of Zone names on success, false otherwise
getZoneArray()
Returns an array of the available zones
public
static getZoneArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The zones array
getZoneIdByPaymentId()
Returns the Zone ID associated with the given Payment ID, if any
public
static getZoneIdByPaymentId(int $payment_id) : int
This shouldn't happen, but if the Payment isn't associated with any Zone, returns null.
Parameters
- $payment_id : int
-
The Payment ID
Tags
Return values
int —The Zone ID, if any, false on failure, or null if none
getZoneIdByShipperId()
Returns the Zone ID for the given shipper ID
public
static getZoneIdByShipperId(int $shipper_id) : int
Parameters
- $shipper_id : int
-
The shipper ID
Return values
int —The Zone ID on success, null otherwise
init()
Initialises all Zones (but no relation)
public
static init([int $localeId = 0 ]) : bool
Parameters
- $localeId : int = 0
-
Optional locale ID. If not set FRONTEND_LANG_ID will be used.
Tags
Return values
bool —True on success, false otherwise
store_from_post()
Stores all changes made to any Zone
public
static store_from_post() : bool
Tags
Return values
bool —True on success, false on failure, or null on noop.
update_shipper_relation()
Updates the relation entry for the given Shipper and Zone ID
public
static update_shipper_relation(int $zone_id, int $shipper_id) : bool
Parameters
- $zone_id : int
-
The Zone ID
- $shipper_id : int
-
The Shipper ID
Tags
Return values
bool —True on success, false otherwise
updateZones()
Updates the Zones with data posted from the form
public
static updateZones([int $localeId = 0 ]) : bool
Parameters
- $localeId : int = 0
-
Optional locale ID. If not set FRONTEND_LANG_ID will be used.
Tags
Return values
bool —True on success, false on failure, null on noop