\Thelia\ActionCart

Class Cart where all actions are manage like adding, modifying or delete items.

Class Cart

Summary

Methods
Properties
Constants
__construct()
addArticle()
deleteArticle()
modifyArticle()
getSubscribedEvents()
getCart()
redirect()
No public properties found
No constants found
updateQuantity()
addItem()
findItem()
createCart()
duplicateCart()
generateCookie()
$dispatcher
N/A
getAddCartForm()
No private properties found
N/A

Properties

$dispatcher

$dispatcher : \Symfony\Component\EventDispatcher\EventDispatcherInterface

Type

\Symfony\Component\EventDispatcher\EventDispatcherInterface

Methods

__construct()

__construct(\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher)

Parameters

\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher

deleteArticle()

deleteArticle(\Thelia\Core\Event\ActionEvent $event)

Delete specify article present into cart

Parameters

\Thelia\Core\Event\ActionEvent $event

modifyArticle()

modifyArticle(\Thelia\Core\Event\ActionEvent $event)

Modify article's quantity

don't use Form here just test the Request.

Parameters

\Thelia\Core\Event\ActionEvent $event

getSubscribedEvents()

getSubscribedEvents() : array

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2'))

Returns

array —

The event names to listen to

getCart()

getCart(\Symfony\Component\HttpFoundation\Request $request) : \Thelia\Model\Cart

search if cart already exists in session. If not try to create a new one or duplicate an old one.

Parameters

\Symfony\Component\HttpFoundation\Request $request

Returns

\Thelia\Model\Cart

redirect()

redirect( $url,  $status)

Parameters

$url
$status

updateQuantity()

updateQuantity(\Thelia\Model\CartItem $cartItem,  $quantity)

Parameters

\Thelia\Model\CartItem $cartItem
$quantity

addItem()

addItem(\Thelia\Model\Cart $cart,  $productId,  $productSaleElementsId,  $quantity, \Thelia\Model\ProductPrice $productPrice)

Parameters

\Thelia\Model\Cart $cart
$productId
$productSaleElementsId
$quantity
\Thelia\Model\ProductPrice $productPrice

findItem()

findItem( $cartId,  $productId,  $productSaleElementsId)

Parameters

$cartId
$productId
$productSaleElementsId

generateCookie()

generateCookie()

getAddCartForm()

getAddCartForm(\Symfony\Component\HttpFoundation\Request $request)

Parameters

\Symfony\Component\HttpFoundation\Request $request