PHP Класс CI_Cart, TastyIgniter

Автор: ExpressionEngine Dev Team
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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)

Свойство Тип Описание
$CI object Reference to CodeIgniter instance
$_cart_contents array Contents of the cart

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
_insert ( $items = [] ) : boolean Insert
_save_cart ( ) : boolean Save the cart array to the session DB
_update ( $items = [] ) : boolean Update the cart

Описание методов

__construct() публичный Метод

The constructor loads the Session class, used to store the shopping cart contents.
public __construct ( $params = [] ) : void
Результат void

_insert() защищенный Метод

Insert
protected _insert ( $items = [] ) : boolean
Результат boolean

_save_cart() защищенный Метод

Save the cart array to the session DB
protected _save_cart ( ) : boolean
Результат boolean

_update() защищенный Метод

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
Результат boolean

contents() публичный Метод

Returns the entire cart array
public contents ( $newest_first = FALSE ) : array
Результат array

destroy() публичный Метод

Empties the cart and kills the session
public destroy ( ) : void
Результат void

format_number() публичный Метод

Returns the supplied number with commas and a decimal point.
public format_number ( $n = '' ) : string
Результат string

get_item() публичный Метод

Returns the details of a specific item in the cart
public get_item ( string $row_id ) : array
$row_id string
Результат array

has_options() публичный Метод

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 = ''
Результат boolean

insert() публичный Метод

Insert items into the cart and save it to the session table
public insert ( $items = [] ) : boolean
Результат boolean

product_options() публичный Метод

Returns the an array of options, for a particular product row ID
public product_options ( string $row_id = '' ) : array
$row_id string = ''
Результат array

remove() публичный Метод

Removes an item from the cart
public remove ( $rowid ) : boolean
Результат boolean

total() публичный Метод

Cart Total
public total ( ) : integer
Результат integer

total_items() публичный Метод

Returns the total item count
public total_items ( ) : integer
Результат integer

update() публичный Метод

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
Результат boolean

Описание свойств

$CI защищенное свойство

Reference to CodeIgniter instance
protected object $CI
Результат object

$_cart_contents защищенное свойство

Contents of the cart
protected array $_cart_contents
Результат array

$product_id_rules публичное свойство

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
Результат string

$product_name_rules публичное свойство

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
Результат string

$product_name_safe публичное свойство

only allow safe product names
public bool $product_name_safe
Результат boolean