Shop_Cart_Controller
extends Core_Servant_Properties
in package
Online store cart operations.
Работа с корзиной интернет-магазина.
Доступные методы:
- shop_item_id($id) идентификатор товара
- quantity($value) количество товара
- marking($value) артикул товара в заказе, если отличается от артикула товара
- postpone(TRUE|FALSE) товар отложен
- shop_warehouse_id($id) идентификатор склада
- siteuser_id($id) идентификатор пользователя сайта
- checkStock(TRUE|FALSE) проверять наличие товара на складе, по умолчанию FALSE
- getLastError() возвращает последний статус ошибки: FALSE - без ошибок, 1 - Shop item id установлен в NULL, 2 - не найден добавляемый товар, 3 - Пользователю запрещен доступ к товару, 4 - передано нулевое количество товара или товара нет на складе.
Доступные свойства:
- totalQuantity общее количество неотложенного товара
- totalAmount сумма неотложенного товара
- totalTax налог неотложенного товара
- totalWeight суммарный вес неотложенного товара
- totalVolume суммарный объем неотложенного товара
- totalQuantityForPurchaseDiscount общее количество неотложенного товара для расчета скидки от суммы заказа
- totalAmountForPurchaseDiscount сумма неотложенного товара для расчета скидки от суммы заказа
- totalDiscountPrices цены товаров для расчета скидки на N-й товар
Tags
Table of Contents
- $instance : mixed
- The singleton instances.
- $_allowedProperties : array<string|int, mixed>
- Allowed object properties
- $_error : mixed
- Last error, default FALSE 1 - Shop item id is NULL 2 - Shop item doesn't exist 3 - Siteuser doesn't have access to the shop item 4 - zero quantity or shop item out of stock
- $_propertiesValues : array<string|int, mixed>
- Properties values
- $_unlimitedProperties : bool
- Object has unlimited number of properties
- __construct() : mixed
- Constructor.
- add() : Shop_Cart_Controller
- Add item into cart
- addAllowedProperties() : self
- Add additional allowed properties
- addAllowedProperty() : self
- Add additional allowed property
- clear() : Shop_Cart_Controller
- Clear cart operation's options
- delete() : Shop_Cart_Controller
- Delete item from cart
- get() : object
- Get item from cart
- getAll() : array<string|int, mixed>
- Get all goods in the cart
- getLastError() : bool|int
- Get Last Error
- instance() : object
- Register an existing instance as a singleton.
- moveTemporaryCart() : self
- Move goods from session cart to database
- set() : self
- Run when writing data to inaccessible properties
- setUnlimitedProperties() : self
- Set unlimitedProperties
- update() : Shop_Cart_Controller
- Update item in cart
- _getDriverName() : srting
- Get full driver name
Properties
$instance
The singleton instances.
public
static mixed
$instance
= array()
$_allowedProperties
Allowed object properties
protected
array<string|int, mixed>
$_allowedProperties
= array('shop_item_id', 'quantity', 'marking', 'postpone', 'shop_warehouse_id', 'siteuser_id', 'checkStock', 'totalQuantity', 'totalAmount', 'totalTax', 'totalWeight', 'totalVolume', 'totalQuantityForPurchaseDiscount', 'totalAmountForPurchaseDiscount', 'totalDiscountPrices')
$_error
Last error, default FALSE 1 - Shop item id is NULL 2 - Shop item doesn't exist 3 - Siteuser doesn't have access to the shop item 4 - zero quantity or shop item out of stock
protected
mixed
$_error
= \FALSE
$_propertiesValues
Properties values
protected
array<string|int, mixed>
$_propertiesValues
= array()
$_unlimitedProperties
Object has unlimited number of properties
protected
bool
$_unlimitedProperties
= \FALSE
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —add()
Add item into cart
public
add() : Shop_Cart_Controller
Tags
Return values
Shop_Cart_Controller —addAllowedProperties()
Add additional allowed properties
public
addAllowedProperties(array<string|int, mixed> $array) : self
Parameters
- $array : array<string|int, mixed>
-
array of properties' names
Return values
self —addAllowedProperty()
Add additional allowed property
public
addAllowedProperty(string $property) : self
Parameters
- $property : string
-
property name
Return values
self —clear()
Clear cart operation's options
public
clear() : Shop_Cart_Controller
Tags
Return values
Shop_Cart_Controller —delete()
Delete item from cart
public
abstract delete() : Shop_Cart_Controller
Tags
Return values
Shop_Cart_Controller —get()
Get item from cart
public
abstract get() : object
Tags
Return values
object —getAll()
Get all goods in the cart
public
abstract getAll(Shop_Model $oShop) : array<string|int, mixed>
Parameters
- $oShop : Shop_Model
-
shop
Tags
Return values
array<string|int, mixed> —getLastError()
Get Last Error
public
getLastError() : bool|int
Return values
bool|int —instance()
Register an existing instance as a singleton.
public
static instance([string $name = 'default' ]) : object
Parameters
- $name : string = 'default'
-
driver's name
Return values
object —moveTemporaryCart()
Move goods from session cart to database
public
abstract moveTemporaryCart(Shop_Model $oShop) : self
Parameters
- $oShop : Shop_Model
-
shop
Tags
Return values
self —set()
Run when writing data to inaccessible properties
public
set(string $property, string $value) : self
Parameters
- $property : string
-
property name
- $value : string
-
property value
Return values
self —setUnlimitedProperties()
Set unlimitedProperties
public
setUnlimitedProperties([bool $value = TRUE ]) : self
Parameters
- $value : bool = TRUE
-
default TRUR
Return values
self —update()
Update item in cart
public
abstract update() : Shop_Cart_Controller
Tags
Return values
Shop_Cart_Controller —_getDriverName()
Get full driver name
protected
static _getDriverName(string $driver) : srting
Parameters
- $driver : string
-
driver name