PHP Class CI_Cart, TastyIgniter

Author: ExpressionEngine Dev Team
Afficher le fichier Open project: tastyigniter/tastyigniter Class Usage Examples

Méthodes publiques

Свойство Type Description
$product_id_rules string These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, or periods
$product_name_rules string These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, colons or periods
$product_name_safe boolean only allow safe product names

Protected Properties

Свойство Type Description
$CI object Reference to CodeIgniter instance
$_cart_contents array Contents of the cart

Méthodes publiques

Méthode Description
__construct ( $params = [] ) : void Shopping Class Constructor
contents ( $newest_first = FALSE ) : array Cart Contents
destroy ( ) : void Destroy the cart
format_number ( $n = '' ) : string Format Number
get_item ( string $row_id ) : array Get cart item
has_options ( string $row_id = '' ) : boolean Has options
insert ( $items = [] ) : boolean Insert items into the cart and save it to the session table
product_options ( string $row_id = '' ) : array Product options
remove ( $rowid ) : boolean Remove Item
total ( ) : integer Cart Total
total_items ( ) : integer Total Items
update ( $items = [] ) : boolean Update the cart

Méthodes protégées

Méthode Description
_insert ( $items = [] ) : boolean Insert
_save_cart ( ) : boolean Save the cart array to the session DB
_update ( $items = [] ) : boolean Update the cart

Method Details

__construct() public méthode

The constructor loads the Session class, used to store the shopping cart contents.
public __construct ( $params = [] ) : void
Résultat void

_insert() protected méthode

Insert
protected _insert ( $items = [] ) : boolean
Résultat boolean

_save_cart() protected méthode

Save the cart array to the session DB
protected _save_cart ( ) : boolean
Résultat boolean

_update() protected méthode

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.
protected _update ( $items = [] ) : boolean
Résultat boolean

contents() public méthode

Returns the entire cart array
public contents ( $newest_first = FALSE ) : array
Résultat array

destroy() public méthode

Empties the cart and kills the session
public destroy ( ) : void
Résultat void

format_number() public méthode

Returns the supplied number with commas and a decimal point.
public format_number ( $n = '' ) : string
Résultat string

get_item() public méthode

Returns the details of a specific item in the cart
public get_item ( string $row_id ) : array
$row_id string
Résultat array

has_options() public méthode

Returns TRUE if the rowid passed to this function correlates to an item that has options associated with it.
public has_options ( string $row_id = '' ) : boolean
$row_id string = ''
Résultat boolean

insert() public méthode

Insert items into the cart and save it to the session table
public insert ( $items = [] ) : boolean
Résultat boolean

product_options() public méthode

Returns the an array of options, for a particular product row ID
public product_options ( string $row_id = '' ) : array
$row_id string = ''
Résultat array

remove() public méthode

Removes an item from the cart
public remove ( $rowid ) : boolean
Résultat boolean

total() public méthode

Cart Total
public total ( ) : integer
Résultat integer

total_items() public méthode

Returns the total item count
public total_items ( ) : integer
Résultat integer

update() public méthode

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 update ( $items = [] ) : boolean
Résultat boolean

Property Details

$CI protected_oe property

Reference to CodeIgniter instance
protected object $CI
Résultat object

$_cart_contents protected_oe property

Contents of the cart
protected array $_cart_contents
Résultat array

$product_id_rules public_oe property

These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, or periods
public string $product_id_rules
Résultat string

$product_name_rules public_oe property

These are the regular expression rules that we use to validate the product ID and product name alpha-numeric, dashes, underscores, colons or periods
public string $product_name_rules
Résultat string

$product_name_safe public_oe property

only allow safe product names
public bool $product_name_safe
Résultat boolean