My Project
 All Data Structures Namespaces Functions Variables
Public Member Functions | Data Fields
CI_Cart Class Reference

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()
 

Constructor & Destructor Documentation

__construct (   $params = array())

Shopping Class Constructor

The constructor loads the Session class, used to store the shopping cart contents.

Member Function Documentation

_insert (   $items = array())

Insert

private

Parameters
array
Returns
bool
_save_cart ( )

Save the cart array to the session DB

private

Returns
bool
_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

Parameters
array
Returns
bool
contents ( )

Cart Contents

Returns the entire cart array

public

Returns
array
destroy ( )

Destroy the cart

Empties the cart and kills the session

public

Returns
null
format_number (   $n = '')

Format Number

Returns the supplied number with commas and a decimal point.

public

Returns
integer
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

Returns
array
insert (   $items = array())

Insert items into the cart and save it to the session table

public

Parameters
array
Returns
bool
product_options (   $rowid = '')

Product options

Returns the an array of options, for a particular product row ID

public

Returns
array
total ( )

Cart Total

public

Returns
integer
total_items ( )

Total Items

Returns the total item count

public

Returns
integer
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

Parameters
array
string
Returns
bool

The documentation for this class was generated from the following file: