Eeco_Gift_Card
in package
Table of Contents
- $data : mixed
- gift card data
- $id : mixed
- gift card id
- __construct() : mixed
- making sure correct data is loaded during initialization
- add_order() : mixed
- add new order for gift card
- delivered() : bool
- set order delivery status
- delivered_on() : int
- Get gift card delivery date
- generate_pdf() : mixed
- generate pdf
- get_amount() : float
- get amount of the gift card
- get_code() : string|int
- get gift card code
- get_date() : string
- get expiration date for the gift card
- get_delivery_date() : string
- gift card has scheduled delivery date
- get_id() : int
- get gift card id
- get_message() : string
- return the custom gift card message
- get_orders() : int
- get order this gift card has been linked to
- get_path() : string
- get the gift card path
- get_receiver_email() : string
- return the receiver email
- get_url() : string
- get the gift card url
- get_used_amount() : float
- get used amount
- get_validator() : string
- get the validator code
- get_value() : float
- get available value
- has_expired() : bool
- checks whether gift card is still valid compares current date to expiration date
- has_value() : bool
- whether gift card has value remaining
- is_active() : bool
- checks if gift card is valid
- is_online() : bool
- whether this gift card is for online use only
- max_discount() : float
- get the maximum value that can be used for given purchase
- reduce_value() : bool
- reduce gift card value
- set_active() : mixed
- sets the active status
- set_is_online() : mixed
- set if gift card is for online
- update_data() : bool
- save gift card meta data
- load_data() : mixed
- load gift card data
- set_id() : mixed
- set gift card id
Properties
$data
gift card data
public
mixed
$data
= array('_gift_card_number' => '', '_gift_card_amount' => 0, '_gift_card_used' => 0, '_gift_card_expires' => '', '_gift_card_order' => 0, '_gift_card_validator' => '', '_gift_card_url' => '', '_gift_card_path' => '', '_used_in_order' => '', '_receiver_email' => '', '_gift_card_message' => '', '_gift_card_is_active' => rue, '_gift_card_delivery_date' => '', '_gift_card_online_instructions' => '', '_gift_card_offline_instructions' => '')
$id
gift card id
private
mixed
$id
=
ull
Methods
__construct()
making sure correct data is loaded during initialization
public
__construct(Eeco_Gift_Card|int|string $data) : mixed
Parameters
- $data : Eeco_Gift_Card|int|string
-
Either code, id or gift card class instance
Return values
mixed —add_order()
add new order for gift card
public
add_order(WC_Order $order, mixed $coupon) : mixed
Parameters
- $order : WC_Order
-
The order
- $coupon : mixed
Return values
mixed —delivered()
set order delivery status
public
delivered() : bool
Return values
bool —delivered_on()
Get gift card delivery date
public
delivered_on() : int
Return values
int —unix Timestamp
generate_pdf()
generate pdf
public
generate_pdf() : mixed
Return values
mixed —get_amount()
get amount of the gift card
public
get_amount() : float
Return values
float —get_code()
get gift card code
public
get_code() : string|int
Return values
string|int —get_date()
get expiration date for the gift card
public
get_date([mixed $format = false ]) : string
Parameters
- $format : mixed = false
Return values
string —get_delivery_date()
gift card has scheduled delivery date
public
get_delivery_date() : string
Return values
string —get_id()
get gift card id
public
get_id() : int
Return values
int —get_message()
return the custom gift card message
public
get_message() : string
Return values
string —get_orders()
get order this gift card has been linked to
public
get_orders() : int
Return values
int —Order id
get_path()
get the gift card path
public
get_path() : string
Return values
string —get_receiver_email()
return the receiver email
public
get_receiver_email() : string
Return values
string —The email
get_url()
get the gift card url
public
get_url() : string
Return values
string —get_used_amount()
get used amount
public
get_used_amount() : float
Return values
float —get_validator()
get the validator code
public
get_validator() : string
Return values
string —get_value()
get available value
public
get_value() : float
Return values
float —has_expired()
checks whether gift card is still valid compares current date to expiration date
public
has_expired() : bool
Return values
bool —has_value()
whether gift card has value remaining
public
has_value([float $amount = null ]) : bool
Parameters
- $amount : float = null
-
If passed checking if has anough value
Return values
bool —is_active()
checks if gift card is valid
public
is_active() : bool
Return values
bool —is_online()
whether this gift card is for online use only
public
is_online() : bool
Return values
bool —max_discount()
get the maximum value that can be used for given purchase
public
max_discount(float $total) : float
Parameters
- $total : float
-
The value to check against
Return values
float —reduce_value()
reduce gift card value
public
reduce_value(float $amount) : bool
Parameters
- $amount : float
-
Amount to reduce
Return values
bool —Success or failure
set_active()
sets the active status
public
set_active(mixed $active) : mixed
Parameters
- $active : mixed
Return values
mixed —set_is_online()
set if gift card is for online
public
set_is_online(bool $is_online) : mixed
Parameters
- $is_online : bool
-
Whether is for online use
Return values
mixed —update_data()
save gift card meta data
public
update_data(string $key, string $value) : bool
Parameters
- $key : string
-
The meta key
- $value : string
-
Value to save
Return values
bool —Success or not
load_data()
load gift card data
private
load_data() : mixed
Return values
mixed —set_id()
set gift card id
private
set_id(int $id) : mixed
Parameters
- $id : int
-
The id