Eeco_WCO_DB
in package
Table of Contents
- $offer_table : mixed
- the offer table name
- $product_table : mixed
- the offer product table
- add_product() : bool
- Add a product for offer
- create_offer() : bool
- Create an offer to database
- edit_offer() : bool
- Edit an offer
- get_offer() : array<string|int, mixed>
- Get an offer
- update_db() : mixed
- update database
Properties
$offer_table
the offer table name
private
mixed
$offer_table
= 'eeco_wco_offers'
$product_table
the offer product table
private
mixed
$product_table
= 'eeco_wco_products'
Methods
add_product()
Add a product for offer
public
add_product(int $post_id, int $product_id, int $quantity, float $total, float $tax) : bool
Parameters
- $post_id : int
-
id of an offer
- $product_id : int
-
id of the product
- $quantity : int
-
quantity of product wanted
- $total : float
-
total price of line total in cart
- $tax : float
-
total tax of line in cart
Return values
bool —true || false if product successfully added to offer
create_offer()
Create an offer to database
public
create_offer(int $post_id, int $user_id, string $type, string $taxes, float $value, string $status, string $expiry_date) : bool
Parameters
- $post_id : int
-
id of a post
- $user_id : int
-
id of a user
- $type : string
-
of an offer
- $taxes : string
-
coupon taxes to taxable or tax free price
- $value : float
-
float of offer value
- $status : string
-
status of an offer
- $expiry_date : string
-
expiry date of an offer
Return values
bool —true || false if offer created
edit_offer()
Edit an offer
public
edit_offer(int $post_id, int $user_id, string $type, string $taxes, float $value) : bool
Parameters
- $post_id : int
-
id of offer to edit
- $user_id : int
-
id of user attached to offer
- $type : string
-
type of offer
- $taxes : string
-
coupon taxes to taxable or tax free price
- $value : float
-
value of the offer
Return values
bool —true || false if offer updated or not
get_offer()
Get an offer
public
get_offer(int $post_id) : array<string|int, mixed>
Parameters
- $post_id : int
-
offer id
Return values
array<string|int, mixed> —Offer data
update_db()
update database
public
update_db() : mixed