Cart
class Cart
Constants
DEFAULT_INSTANCE |
|
Properties
protected Store | $session | Instance of the session manager. |
|
protected Dispatcher | $events | Instance of the event dispatcher. |
|
protected string | $instance | Holds the current cart instance. |
|
protected CartConditions | $conditions | Instance of the cart condition. |
Methods
Cart constructor.
Get the current cart instance.
Add an item to the cart.
Remove the cart item with the given rowId from the cart.
Destroy the current cart instance.
Get the content of the cart.
Get the number of items in the cart.
Get the total price of the items (with conditions) in the cart.
Get the subtotal (with conditions) of the items in the cart.
Associate the cart item with the given rowId with the given model.
No description
Get condition applied on the cart by its name
Clear a condition on a cart by its name,
No description
No description
No description
No description
Remove all applied conditions from all cart items
No description
Get the carts content, if there is no cart content set yet, return a new empty Collection
Get the carts conditions, if there is no cart condition set yet, return a new empty Collection
Create a new CartItem from the supplied attributes.
Check if the item is a multidimensional array or an array of Buyables.
Store the current instance of the cart.
Restore the cart with the given identifier.
No description
No description
No description
Create a new instance of the model
No description
No description
No description
Details
at line 52
__construct(SessionManager $session, Dispatcher $events)
Cart constructor.
at line 67
Cart
instance(string|null $instance = null)
Set the current cart instance.
at line 83
string
currentInstance()
Get the current cart instance.
at line 98
array|CartItem
add($buyable, int $qty = 0, array $options = [], null $comment = null)
Add an item to the cart.
at line 135
CartItem|bool
update(string $rowId, mixed $qty)
Update the cart item with the given rowId.
at line 186
void
remove(string $rowId)
Remove the cart item with the given rowId from the cart.
at line 208
CartItem
get(string $rowId)
Get a cart item from the cart by its rowId.
at line 224
void
destroy(mixed $identifier = null)
Destroy the current cart instance.
at line 240
CartContent
content()
Get the content of the cart.
at line 250
int|float
count()
Get the number of items in the cart.
at line 260
string
total()
Get the total price of the items (with conditions) in the cart.
at line 270
float
subtotal()
Get the subtotal (with conditions) of the items in the cart.
at line 282
CartContent
search(Closure $search)
Search the cart content for a cart item matching the given search closure.
at line 297
void
associate(string $rowId, mixed $model)
Associate the cart item with the given rowId with the given model.
at line 321
CartConditions
conditions()
No description
at line 337
CartCondition
getCondition($name)
Get condition applied on the cart by its name
at line 349
bool
removeCondition($name)
Clear a condition on a cart by its name,
at line 365
clearConditions()
No description
at line 381
condition($condition)
No description
at line 387
loadConditions()
No description
at line 392
loadCondition(CartCondition $condition)
No description
at line 420
protected
applyAllConditionsToItem(CartItem $cartItem)
Applies all conditions to a cart item.
at line 427
protected
applyConditionToItem(CartCondition $condition, CartItem $cartItem)
No description
at line 444
protected null|CartCondition
getApplicableItemCondition($condition, $cartItem)
No description
at line 460
protected
loadItemsCondition(CartCondition $condition)
Load condition on all existing cart items
at line 476
protected
removeItemCondition(CartCondition $condition)
Remove an applied condition from all cart items
at line 490
protected
clearItemConditions()
Remove all applied conditions from all cart items
at line 505
clearContent()
No description
at line 519
protected CartContent
getContent()
Get the carts content, if there is no cart content set yet, return a new empty Collection
at line 532
protected CartConditions
getConditions()
Get the carts conditions, if there is no cart condition set yet, return a new empty Collection
at line 550
protected CartItem
createCartItem($buyable, int $qty = 0, array $options = [], null $comment = null)
Create a new CartItem from the supplied attributes.
at line 572
protected bool
isMulti(mixed $item)
Check if the item is a multidimensional array or an array of Buyables.
at line 586
void
store(mixed $identifier)
Store the current instance of the cart.
at line 607
restore(mixed $identifier)
Restore the cart with the given identifier.
at line 636
deleteStored($identifier)
No description
at line 648
protected bool
storedCartWithIdentifierExists($identifier)
No description
at line 655
protected
getStoredCartByIdentifier($identifier)
No description
at line 666
protected mixed
createModel()
Create a new instance of the model
at line 679
protected
getSession($key, $default = null)
No description
at line 684
protected
putSession($key, $content)
No description
at line 699
protected mixed
fireEvent($name, $payload = null)
No description