\CI_Cart

Shopping Cart Class

Summary

Methods
Properties
Constants
__construct()
insert()
_insert()
update()
_update()
_save_cart()
total()
total_items()
contents()
has_options()
product_options()
format_number()
destroy()
$product_id_rules
$product_name_rules
$CI
$_cart_contents
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$product_id_rules

$product_id_rules : 

Type

$product_name_rules

$product_name_rules : 

Type

$CI

$CI : 

Type

$_cart_contents

$_cart_contents : 

Type

Methods

__construct()

__construct(  $params = array()) 

Shopping Class Constructor

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

Parameters

$params

insert()

insert(  $items = array()) : boolean

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

Parameters

$items

Returns

boolean

_insert()

_insert(  $items = array()) : boolean

Insert

Parameters

$items

Returns

boolean

update()

update(  $items = array()) : boolean

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.

Parameters

$items

Returns

boolean

_update()

_update(  $items = array()) : boolean

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.

Parameters

$items

Returns

boolean

_save_cart()

_save_cart() : boolean

Save the cart array to the session DB

Returns

boolean

total()

total() : integer

Cart Total

Returns

integer

total_items()

total_items() : integer

Total Items

Returns the total item count

Returns

integer

contents()

contents() : array

Cart Contents

Returns the entire cart array

Returns

array

has_options()

has_options(  $rowid = '') : array

Has options

Returns TRUE if the rowid passed to this function correlates to an item that has options associated with it.

Parameters

$rowid

Returns

array

product_options()

product_options(  $rowid = '') : array

Product options

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

Parameters

$rowid

Returns

array

format_number()

format_number(  $n = '') : integer

Format Number

Returns the supplied number with commas and a decimal point.

Parameters

$n

Returns

integer

destroy()

destroy() : null

Destroy the cart

Empties the cart and kills the session

Returns

null