Public Member Functions | |
__construct ($params=array()) | |
insert ($items=array()) | |
_insert ($items=array()) | |
update ($items=array()) | |
_update ($items=array()) | |
_save_cart () | |
total () | |
total_items () | |
contents () | |
has_options ($rowid= '') | |
product_options ($rowid= '') | |
format_number ($n= '') | |
destroy () | |
Data Fields | |
$product_id_rules = '\.a-z0-9_-' | |
$product_name_rules = '\.\:\-_ a-z0-9' | |
$CI | |
$_cart_contents = array() | |
__construct | ( | $params = array() ) |
Shopping Class Constructor
The constructor loads the Session class, used to store the shopping cart contents.
_insert | ( | $items = array() ) |
Insert
private
array |
_save_cart | ( | ) |
Save the cart array to the session DB
private
_update | ( | $items = array() ) |
Update the cart
This function permits the quantity of a given item to be changed. Typically it is called from the "view cart" page if a user makes changes to the quantity before checkout. That array must contain the product ID and quantity for each item.
private
array |
contents | ( | ) |
Cart Contents
Returns the entire cart array
public
destroy | ( | ) |
Destroy the cart
Empties the cart and kills the session
public
format_number | ( | $n = '' ) |
Format Number
Returns the supplied number with commas and a decimal point.
public
has_options | ( | $rowid = '' ) |
Has options
Returns TRUE if the rowid passed to this function correlates to an item that has options associated with it.
public
insert | ( | $items = array() ) |
Insert items into the cart and save it to the session table
public
array |
product_options | ( | $rowid = '' ) |
Product options
Returns the an array of options, for a particular product row ID
public
total | ( | ) |
Cart Total
public
total_items | ( | ) |
Total Items
Returns the total item count
public
update | ( | $items = array() ) |
Update the cart
This function permits the quantity of a given item to be changed. Typically it is called from the "view cart" page if a user makes changes to the quantity before checkout. That array must contain the product ID and quantity for each item.
public
array | |
string |