Class CI_Cart - echiong/testRepo GitHub Wiki
##Class CI_Cart
Shopping Cart Class
Package: [[CodeIgniter<a href="Package CodeIgniter.Libraries.md">Libraries]]
Category:
Shopping Cart
Author:
ExpressionEngine Dev Team
Link:
http://codeigniter.com/user_guide/libraries/cart.html
Located at system/libraries/Cart.php
##Methods summary
public __construct ( mixed $params = array() )
Shopping Class Constructor
The constructor loads the Session class, used to store the shopping cart contents.
public boolean insert ( array $items = array() )
Insert items into the cart and save it to the session table
Parameters
$items
array
Returns
boolean
public boolean _insert ( array $items = array() )
Insert
Parameters
$items
array
Returns
boolean
public boolean update ( array $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.
Parameters
$items
array
Returns
boolean
public boolean _update ( array $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.
Parameters
$items
array
Returns
boolean
public boolean _save_cart ( )
Save the cart array to the session DB
Returns
boolean
public integer total ( )
Cart Total
Returns
integer
public integer total_items ( )
Total Items
Returns the total item count
Returns
integer
public array contents ( )
Cart Contents
Returns the entire cart array
Returns
array
public array has_options ( mixed $rowid = '' )
Has options
Returns TRUE if the rowid passed to this function correlates to an item that has options associated with it.
Returns
array
public array product_options ( mixed $rowid = '' )
Product options
Returns the an array of options, for a particular product row ID
Returns
array
public integer format_number ( mixed $n = '' )
Format Number
Returns the supplied number with commas and a decimal point.
Returns
integer
public null destroy ( )
Destroy the cart
Empties the cart and kills the session
Returns
null
<table class="summary" id="properties">
<caption>Properties summary</caption>
<tr data-order="product_id_rules" id="$product_id_rules">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$product_id_rules
'.a-z0-9_-'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="product_name_rules" id="$product_name_rules">
<td class="attributes"><code>
public
string
</code></td>
<td class="name">
$product_name_rules
'.:-_ a-z0-9'
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="CI" id="$CI">
<td class="attributes"><code>
public
mixed
</code></td>
<td class="name">
$CI
<div class="description detailed">
</div>
</div></td>
</tr>
<tr data-order="_cart_contents" id="$_cart_contents">
<td class="attributes"><code>
public
array
</code></td>
<td class="name">
$_cart_contents
array()
<div class="description detailed">
</div>
</div></td>
</tr>
</table>