SharedShoppingCartService
in package
implements
SharedShoppingCartServiceInterface
Class SharedShoppingCartService
Tags
Interfaces, Classes and Traits
- SharedShoppingCartServiceInterface
- Interface SharedShoppingCartServiceInterface
Table of Contents
- $repository : SharedShoppingCartRepository
- $settings : SharedShoppingCartSettingsInterface
- __construct() : mixed
- SharedShoppingCartService constructor.
- deleteExpiredShoppingCarts() : mixed
- Deletes all shared shopping carts that exceeded the configured life period
- deleteShoppingCartsByCustomerId() : mixed
- Deletes all shared shopping carts by a given customer ID.
- getShoppingCart() : array<string|int, mixed>
- Gets the content of the shopping cart corresponding to the hash
- getShoppingCartsByCustomerId() : SharedShoppingCartCollection
- Gets a collection of all shared shopping carts by a given customer ID.
- storeShoppingCart() : string
- Stores the cart and returns the hash
Properties
$repository
protected
SharedShoppingCartRepository
$repository
$settings
protected
SharedShoppingCartSettingsInterface
$settings
Methods
__construct()
SharedShoppingCartService constructor.
public
__construct(SharedShoppingCartRepository $repository, SharedShoppingCartSettingsInterface $settings) : mixed
Parameters
- $repository : SharedShoppingCartRepository
- $settings : SharedShoppingCartSettingsInterface
Return values
mixed —deleteExpiredShoppingCarts()
Deletes all shared shopping carts that exceeded the configured life period
public
deleteExpiredShoppingCarts() : mixed
Return values
mixed —deleteShoppingCartsByCustomerId()
Deletes all shared shopping carts by a given customer ID.
public
deleteShoppingCartsByCustomerId(IdType $customerId) : mixed
Parameters
- $customerId : IdType
Return values
mixed —getShoppingCart()
Gets the content of the shopping cart corresponding to the hash
public
getShoppingCart(StringType $shoppingCartHash) : array<string|int, mixed>
Parameters
- $shoppingCartHash : StringType
-
Hash of the shopping cart
Return values
array<string|int, mixed> —Content of the shopping cart
getShoppingCartsByCustomerId()
Gets a collection of all shared shopping carts by a given customer ID.
public
getShoppingCartsByCustomerId(IdType $customerId) : SharedShoppingCartCollection
Parameters
- $customerId : IdType
Return values
SharedShoppingCartCollection —storeShoppingCart()
Stores the cart and returns the hash
public
storeShoppingCart(array<string|int, mixed> $shoppingCartContent[, IdType|null $userId = null ]) : string
Parameters
- $shoppingCartContent : array<string|int, mixed>
-
The cart content
- $userId : IdType|null = null
-
The user ID of the user who is sharing the cart
Return values
string —The hash of the cart