PriceList
in package
Pricelist
Creates a PDF document with product price information
Tags
Table of Contents
Properties
- $arrCategoryId : string
- Category IDs included in the list (comma separated, or "*" for all)
- $border : bool
- Border enabled?
- $currency_id : int
- The currency ID
- $font : string
- Pricelist font face
- $font_size_footer : int
- Footer font size
- $font_size_header : int
- Header font size
- $font_size_list : int
- List font size
- $footer : bool
- Footer enabled?
- $footer_left : string
- Left footer content
- $footer_right : string
- Right footer content
- $header : bool
- Header enabled?
- $header_left : string
- Left header content
- $header_right : string
- Right header content
- $id : int
- The list ID
- $lang_id : int
- The language ID
- $name : string
- List name
- $row_color_1 : string
- Odd row background color, in CSS hex format (RRGGBB)
- $row_color_2 : string
- Even row background color, in CSS hex format (RRGGBB)
Methods
- __construct() : Pricelist
- Constructor
- border() : mixed
- category_ids() : string
- Returns the comma separated list of Categories, or "*" for all
- currency_id() : mixed
- decode() : string
- Returns the string decoded from UTF-8 if necessary
- deleteByRequest() : mixed
- font() : mixed
- font_size_footer() : mixed
- font_size_header() : mixed
- font_size_list() : mixed
- footer() : mixed
- footer_left() : mixed
- footer_right() : mixed
- getById() : Pricelist
- Returns the Pricelist for the given ID
- getFromPost() : Pricelist
- Returns a Pricelist with properties taken from the posted data
- getNameArray() : array<string|int, mixed>
- Returns an array of Pricelist names, indexed by their respective ID
- getUrl() : string
- Returns the absolute URL for linking to the PDF list with the given ID
- header() : mixed
- header_left() : mixed
- header_right() : mixed
- id() : mixed
- insert() : bool
- Inserts this Pricelist
- lang_id() : mixed
- load() : bool
- (Re-)load this Pricelist
- name() : mixed
- row_color_1() : mixed
- row_color_2() : mixed
- send_as_pdf() : bool
- Creates a PDF document and sends this pricelist to the client
- store() : bool
- Stores this Pricelist
- update() : bool
- Updates this Pricelist
- _deleteById() : bool
- Deletes the Pricelist with the given ID
Properties
$arrCategoryId
Category IDs included in the list (comma separated, or "*" for all)
private
string
$arrCategoryId
= array('*')
$border
Border enabled?
private
bool
$border
= true
$currency_id
The currency ID
private
int
$currency_id
= null
$font
Pricelist font face
private
string
$font
= 'Helvetica'
$font_size_footer
Footer font size
private
int
$font_size_footer
= 7
$font_size_header
Header font size
private
int
$font_size_header
= 8
$font_size_list
List font size
private
int
$font_size_list
= 7
$footer
Footer enabled?
private
bool
$footer
= true
$footer_left
Left footer content
private
string
$footer_left
= null
$footer_right
Right footer content
private
string
$footer_right
= null
$header
Header enabled?
private
bool
$header
= true
$header_left
Left header content
private
string
$header_left
= null
$header_right
Right header content
private
string
$header_right
= null
$id
The list ID
private
int
$id
= null
$lang_id
The language ID
private
int
$lang_id
= null
$name
List name
private
string
$name
= null
$row_color_1
Odd row background color, in CSS hex format (RRGGBB)
private
string
$row_color_1
= 'dddddd'
$row_color_2
Even row background color, in CSS hex format (RRGGBB)
private
string
$row_color_2
= 'ffffff'
Methods
__construct()
Constructor
public
__construct(mixed $list_id[, int $currency_id = null ][, int $lang_id = null ]) : Pricelist
Uses FRONTEND_LANG_ID for $lang_id, and the default for $currency_id if either is empty. Note that the language ID is overridden by load() if it is defined for this Pricelist.
Parameters
- $list_id : mixed
- $currency_id : int = null
-
The optional Currency ID
- $lang_id : int = null
-
The optional language ID
Return values
Pricelist —The Pricelist
border()
public
border([mixed $border = null ]) : mixed
Parameters
- $border : mixed = null
category_ids()
Returns the comma separated list of Categories, or "*" for all
public
category_ids([mixed $category_ids = null ]) : string
Optionally sets the Category IDs to the value of $category_ids. $category_ids may be a comma separated string, or an array of IDs.
Parameters
- $category_ids : mixed = null
-
An optional comma separated list of Category IDs, or an array of IDs
Return values
string —The comma separated list of Category IDs
currency_id()
public
currency_id([mixed $currency_id = null ]) : mixed
Parameters
- $currency_id : mixed = null
decode()
Returns the string decoded from UTF-8 if necessary
public
static decode(string $string) : string
Parameters
- $string : string
-
The string to be decoded
Return values
string —The decoded string
deleteByRequest()
public
static deleteByRequest() : mixed
font()
public
font([mixed $font = null ]) : mixed
Parameters
- $font : mixed = null
font_size_footer()
public
font_size_footer([mixed $font_size_footer = null ]) : mixed
Parameters
- $font_size_footer : mixed = null
font_size_header()
public
font_size_header([mixed $font_size_header = null ]) : mixed
Parameters
- $font_size_header : mixed = null
font_size_list()
public
font_size_list([mixed $font_size_list = null ]) : mixed
Parameters
- $font_size_list : mixed = null
footer()
public
footer([mixed $footer = null ]) : mixed
Parameters
- $footer : mixed = null
footer_left()
public
footer_left([mixed $footer_left = null ]) : mixed
Parameters
- $footer_left : mixed = null
footer_right()
public
footer_right([mixed $footer_right = null ]) : mixed
Parameters
- $footer_right : mixed = null
getById()
Returns the Pricelist for the given ID
public
static getById(int $list_id) : Pricelist
Parameters
- $list_id : int
-
The Pricelist ID
Return values
Pricelist —The Pricelist on success, false otherwise
getFromPost()
Returns a Pricelist with properties taken from the posted data
public
static getFromPost() : Pricelist
Backend use only. Takes its arguments directly from the form values. If no form has been posted, returns null.
Tags
Return values
Pricelist —The Pricelist on success, null otherwise
getNameArray()
Returns an array of Pricelist names, indexed by their respective ID
public
static getNameArray() : array<string|int, mixed>
Backend use only.
Return values
array<string|int, mixed> —The Pricelist name array
getUrl()
Returns the absolute URL for linking to the PDF list with the given ID
public
static getUrl(int $list_id) : string
Parameters
- $list_id : int
-
The list ID
Return values
string —The list URL
header()
public
header([mixed $header = null ]) : mixed
Parameters
- $header : mixed = null
header_left()
public
header_left([mixed $header_left = null ]) : mixed
Parameters
- $header_left : mixed = null
header_right()
public
header_right([mixed $header_right = null ]) : mixed
Parameters
- $header_right : mixed = null
id()
public
id() : mixed
insert()
Inserts this Pricelist
public
insert() : bool
Updates the ID property accordingly.
Return values
bool —True on success, false otherwise
lang_id()
public
lang_id([mixed $lang_id = null ]) : mixed
Parameters
- $lang_id : mixed = null
load()
(Re-)load this Pricelist
public
load() : bool
Note that the language ID set in the dataset will override the one set in the constructor iff it's not empty.
Return values
bool —True on success, false otherwise
name()
public
name([mixed $name = null ]) : mixed
Parameters
- $name : mixed = null
row_color_1()
public
row_color_1([mixed $row_color_1 = null ]) : mixed
Parameters
- $row_color_1 : mixed = null
row_color_2()
public
row_color_2([mixed $row_color_2 = null ]) : mixed
Parameters
- $row_color_2 : mixed = null
send_as_pdf()
Creates a PDF document and sends this pricelist to the client
public
send_as_pdf() : bool
Unfortunately, ezpdf does not return anything after printing the document, so there's no way to tell whether it has succeeded. Thus, you should not rely on the return value, except when it is false -- in that case, loading of some data failed.
Return values
bool —False on failure, true on supposed success
store()
Stores this Pricelist
public
store() : bool
Return values
bool —True on success, false otherwise
update()
Updates this Pricelist
public
update() : bool
Return values
bool —True on success, false otherwise
_deleteById()
Deletes the Pricelist with the given ID
private
static _deleteById(int $list_id) : bool
Doesn't care whether the ID exists in the database.
Parameters
- $list_id : int
-
The Pricelist ID to be deleted
Return values
bool —True on success, false otherwise