SharedShoppingCartService

Implements \SharedShoppingCartServiceInterface

Class SharedShoppingCartService

category

System

package

SharedShoppingCart

Methods

SharedShoppingCartService constructor.

__construct(\SharedShoppingCartRepository $repository, \SharedShoppingCartSettingsInterface $settings) 

Deletes all shared shopping carts that exceeded the configured life period

deleteExpiredShoppingCarts() 

Deletes all shared shopping carts by a given customer ID.

deleteShoppingCartsByCustomerId(\IdType $customerId) 

Arguments

$customerId

\IdType

Gets the content of the shopping cart corresponding to the hash

getShoppingCart(\StringType $shoppingCartHash) : array

Arguments

$shoppingCartHash

\StringType

Hash of the shopping cart

Response

array

Content of the shopping cart

Gets a collection of all shared shopping carts by a given customer ID.

getShoppingCartsByCustomerId(\IdType $customerId) : \SharedShoppingCartCollection

Arguments

$customerId

\IdType

Response

\SharedShoppingCartCollection

Stores the cart and returns the hash

storeShoppingCart(array $shoppingCartContent, \IdType|null $userId = null) : string

Arguments

$shoppingCartContent

array

The cart content

$userId

\IdType|null

The user ID of the user who is sharing the cart

Response

string

The hash of the cart

Properties

repository

repository : \SharedShoppingCartRepository

settings

settings : \SharedShoppingCartSettingsInterface