Voucher
extends BaseContent
in package
Uses
RangeActive
Define system voucher object
Tags
Table of Contents
- $ : string|null
- $ : int|null
- $ : int|null
- $ : bool|null
- $used_code : string|null
- The used code in a relation
- $_individualValue : float
- Buffer for individual value
- $db : VoucherDBAL|null
- __construct() : mixed
- Voucher constructor.
- AffectArticlePrice() : array<string|int, mixed>
- Affect the article price with percentage vouchers
- AffectArticleTrailPeriod() : array<string|int, mixed>|null
- Apply voucher prolonged trail time
- AffectPrice() : void
- Affect the overall price
- AffiliateCompany() : Company|null
- Get company reference
- Articles() : array<string|int, mixed>
- Get all restriction articles
- CreateVoucherCode() : Result
- Create one individual voucher code
- CreateVoucherCodes() : Result
- Create a set of voucher codes based on definition
- EffectiveValue() : float
- IndividualValue() : float
- IndividualVoucher() : array<string|int, mixed>|null
- Get raw voucher by id
- IsActive() : bool
- Check is active state
- ListArticles() : array<string|int, Article>
- Get list of articles relation
- RestrictToArticleCategories() : array<string|int, mixed>|null
- Is restricted to certain category?
- RestrictToArticles() : array<string|int, mixed>|null
- Check restriction to certain articles
- ToPlainObject() : mixed
- database() : VoucherDBAL
- Get the database
Properties
$
public
string|null
$
code The global code in a relation
$
public
int|null
$
value The effect value
$
public
int|null
$
minimal_price The minimal required basket price
$
public
bool|null
$
individual_value Use individual amount based on sale
$used_code
The used code in a relation
public
string|null
$used_code
= null
$_individualValue
Buffer for individual value
private
float
$_individualValue
= 0.0
$db
private
VoucherDBAL|null
$db
= null
Methods
__construct()
Voucher constructor.
public
__construct([null|int $id = null ][, null|string $language = null ]) : mixed
Parameters
- $id : null|int = null
-
The voucher id
- $language : null|string = null
-
The local language or null
Return values
mixed —AffectArticlePrice()
Affect the article price with percentage vouchers
public
AffectArticlePrice(array<string|int, mixed> $price) : array<string|int, mixed>
Parameters
- $price : array<string|int, mixed>
Return values
array<string|int, mixed> —AffectArticleTrailPeriod()
Apply voucher prolonged trail time
public
AffectArticleTrailPeriod(array<string|int, mixed>|null $value) : array<string|int, mixed>|null
Parameters
- $value : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —AffectPrice()
Affect the overall price
public
AffectPrice([object|null $price = null ]) : void
Parameters
- $price : object|null = null
-
Can be null
Return values
void —AffiliateCompany()
Get company reference
public
AffiliateCompany() : Company|null
Return values
Company|null —Articles()
Get all restriction articles
public
Articles() : array<string|int, mixed>
Return values
array<string|int, mixed> —CreateVoucherCode()
Create one individual voucher code
public
CreateVoucherCode([int $length = 16 ][, string|null $prefix = null ][, bool|null $is_assigned = false ][, float|null $value = null ]) : Result
Parameters
- $length : int = 16
-
The length for the random part
- $prefix : string|null = null
-
An individual prefix
- $is_assigned : bool|null = false
-
Is assigned to certain user
- $value : float|null = null
-
Has individual value
Return values
Result —CreateVoucherCodes()
Create a set of voucher codes based on definition
public
CreateVoucherCodes([string $prefix = '' ][, int $count = 1000 ][, int $length = 16 ][, float|null $value = null ]) : Result
Parameters
- $prefix : string = ''
-
An optional prefix
- $count : int = 1000
-
The overall sum of items to add
- $length : int = 16
-
The individual length
- $value : float|null = null
-
Has individual value
Return values
Result —The result object
EffectiveValue()
public
EffectiveValue() : float
Return values
float —IndividualValue()
public
IndividualValue([float|null $content = null ]) : float
Parameters
- $content : float|null = null
Return values
float —IndividualVoucher()
Get raw voucher by id
public
IndividualVoucher(int|string $id) : array<string|int, mixed>|null
Parameters
- $id : int|string
Return values
array<string|int, mixed>|null —IsActive()
Check is active state
public
IsActive([array<string|int, mixed>|null $row = null ][, string $from = 'datefrom' ][, string $to = 'dateto' ][, int|null $now = null ]) : bool
Check if the element is active and valid at the current time
Parameters
- $row : array<string|int, mixed>|null = null
- $from : string = 'datefrom'
- $to : string = 'dateto'
- $now : int|null = null
Return values
bool —Entry is active based on date from and date to property
ListArticles()
Get list of articles relation
public
ListArticles() : array<string|int, Article>
Return values
array<string|int, Article> —List of assignments
RestrictToArticleCategories()
Is restricted to certain category?
public
RestrictToArticleCategories() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —RestrictToArticles()
Check restriction to certain articles
public
RestrictToArticles() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —ToPlainObject()
public
ToPlainObject([mixed $language = null ][, mixed $with_parent = true ]) : mixed
Parameters
- $language : mixed = null
- $with_parent : mixed = true
Tags
Return values
mixed —database()
Get the database
private
database() : VoucherDBAL