PHP Класс LukePOLO\LaraCart\CartItem

Наследование: use trait LukePOLO\LaraCart\Traits\CartOptionsMagicMethodsTrait
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$couponInfo
$discount
$internationalFormat
$lineItem
$locale
$subItems

Защищенные свойства (Protected)

Свойство Тип Описание
$itemHash
$itemModel
$itemModelRelations

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

Метод Описание
__construct ( $id, $name, integer $qty, string $price, array $options = [], boolean $taxable = true, boolean | false $lineItem = false ) CartItem constructor.
addSubItem ( array $subItem, boolean $autoUpdate = true ) : CartSubItem Adds an sub item to a item.
find ( $data ) : mixed Search for matching options on the item.
findSubItem ( $subItemHash ) : mixed Finds a sub item by its hash.
generateHash ( boolean $force = false ) : string Generates a hash based on the cartItem array.
getDiscount ( boolean $format = true ) : string Gets the discount of an item.
getHash ( ) : mixed Gets the hash for the item.
getModel ( ) Returns a Model.
price ( boolean $format = true, boolean $taxedItemsOnly = false ) : string Gets the price of the item with or without tax, with the proper format.
removeSubItem ( $subItemHash ) Removes a sub item from the item.
searchForSubItem ( $data ) : array A way to find sub items.
setModel ( $itemModel, array $relations = [] ) Sets the related model to the item.
subItemsTotal ( boolean $format = true, boolean $taxedItemsOnly = false ) : string Gets the totals for the options.
subTotal ( boolean $format = true, boolean $withDiscount = true, boolean $taxedItemsOnly = false ) : string Gets the sub total of the item based on the qty with or without tax in the proper format.
tax ( integer $amountNotTaxable ) : integer | mixed Gets the tax for the item.

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

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

CartItem constructor.
public __construct ( $id, $name, integer $qty, string $price, array $options = [], boolean $taxable = true, boolean | false $lineItem = false )
$id
$name
$qty integer
$price string
$options array
$taxable boolean
$lineItem boolean | false

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

Adds an sub item to a item.
public addSubItem ( array $subItem, boolean $autoUpdate = true ) : CartSubItem
$subItem array
$autoUpdate boolean
Результат CartSubItem

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

Search for matching options on the item.
public find ( $data ) : mixed
Результат mixed

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

Finds a sub item by its hash.
public findSubItem ( $subItemHash ) : mixed
$subItemHash
Результат mixed

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

Generates a hash based on the cartItem array.
public generateHash ( boolean $force = false ) : string
$force boolean
Результат string itemHash

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

Gets the discount of an item.
public getDiscount ( boolean $format = true ) : string
$format boolean
Результат string

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

Gets the hash for the item.
public getHash ( ) : mixed
Результат mixed

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

Returns a Model.
public getModel ( )

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

Gets the price of the item with or without tax, with the proper format.
public price ( boolean $format = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$taxedItemsOnly boolean
Результат string

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

Removes a sub item from the item.
public removeSubItem ( $subItemHash )
$subItemHash

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

A way to find sub items.
public searchForSubItem ( $data ) : array
$data
Результат array

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

Sets the related model to the item.
public setModel ( $itemModel, array $relations = [] )
$itemModel
$relations array

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

Gets the totals for the options.
public subItemsTotal ( boolean $format = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$taxedItemsOnly boolean
Результат string

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

Gets the sub total of the item based on the qty with or without tax in the proper format.
public subTotal ( boolean $format = true, boolean $withDiscount = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$withDiscount boolean
$taxedItemsOnly boolean
Результат string

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

Gets the tax for the item.
public tax ( integer $amountNotTaxable ) : integer | mixed
$amountNotTaxable integer
Результат integer | mixed

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

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

public $couponInfo

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

public $discount

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

public $internationalFormat

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

protected $itemHash

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

protected $itemModel

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

protected $itemModelRelations

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

public $lineItem

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

public $locale

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

public $subItems