Skip to content

CI_Cart

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_Cart

Shopping Cart Class

  • Class name: CI_Cart
  • Namespace:
  • Warning: this class is deprecated. This means that this class will likely be removed in a future version.

Properties

$product_id_rules

public string $product_id_rules = '\.a-z0-9_-'

These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, or periods

  • Visibility: public
  • Warning: this property is deprecated. This means that this property will likely be removed in a future version.

$product_name_rules

public string $product_name_rules = '\w \-\.\:'

These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, colons or periods

  • Visibility: public
  • Warning: this property is deprecated. This means that this property will likely be removed in a future version.

$product_name_safe

public boolean $product_name_safe = TRUE

only allow safe product names

  • Visibility: public
  • Warning: this property is deprecated. This means that this property will likely be removed in a future version.

$CI

protected object $CI

Reference to CodeIgniter instance

  • Visibility: protected
  • Warning: this property is deprecated. This means that this property will likely be removed in a future version.

$_cart_contents

protected array $_cart_contents = array()

Contents of the cart

  • Visibility: protected
  • Warning: this property is deprecated. This means that this property will likely be removed in a future version.

Methods

__construct

void CI_Cart::__construct($params)

Shopping Class Constructor

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

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $params mixed

insert

boolean CI_Cart::insert($items)

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

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $items mixed

_insert

boolean CI_Cart::_insert($items)

Insert

  • Visibility: protected
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $items mixed

update

boolean CI_Cart::update($items)

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.

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $items mixed

_update

boolean CI_Cart::_update($items)

Update the cart

This function permits changing item properties. Typically it is called from the "view cart" page if a user makes changes to the quantity before checkout. That array must contain the rowid and quantity for each item.

  • Visibility: protected
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $items mixed

_save_cart

boolean CI_Cart::_save_cart()

Save the cart array to the session DB

  • Visibility: protected
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

total

integer CI_Cart::total()

Cart Total

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

remove

boolean CI_Cart::remove($rowid)

Remove Item

Removes an item from the cart

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $rowid mixed

total_items

integer CI_Cart::total_items()

Total Items

Returns the total item count

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

contents

array CI_Cart::contents($newest_first)

Cart Contents

Returns the entire cart array

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $newest_first mixed

get_item

array CI_Cart::get_item(string $row_id)

Get cart item

Returns the details of a specific item in the cart

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $row_id string

has_options

boolean CI_Cart::has_options(string $row_id)

Has options

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

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $row_id string - <p>= ''</p>

product_options

array CI_Cart::product_options(string $row_id)

Product options

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

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $row_id string - <p>= ''</p>

format_number

string CI_Cart::format_number($n)

Format Number

Returns the supplied number with commas and a decimal point.

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.

Arguments

  • $n mixed

destroy

void CI_Cart::destroy()

Destroy the cart

Empties the cart and kills the session

  • Visibility: public
  • Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Clone this wiki locally