Documentation

Shop_Cart_Controller extends Core_Servant_Properties
in package

AbstractYes

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-й товар
$Shop_Cart_Controller = Shop_Cart_Controller::instance(); $aShop_Cart = $Shop_Cart_Controller->getAll($oShop);
Tags
subpackage

Shop

version
7.x
author

Hostmake LLC

copyright

© 2005-2024 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

Properties

$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

Methods

__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

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

get()

Get item from cart

public abstract get() : object
Tags
hostcms-event

Shop_Cart_Controller.onBeforeGet

hostcms-event

Shop_Cart_Controller.onAfterGet

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
hostcms-event

Shop_Cart_Controller.onBeforeGetAll

hostcms-event

Shop_Cart_Controller.onAfterGetAll

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
hostcms-event

Shop_Cart_Controller.onBeforeMoveTemporaryCart

hostcms-event

Shop_Cart_Controller.onAfterMoveTemporaryCart

hostcms-event

Shop_Cart_Controller.onAfterMoveTemporaryCartItem

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

_getDriverName()

Get full driver name

protected static _getDriverName(string $driver) : srting
Parameters
$driver : string

driver name

Return values
srting

        
On this page

Search results