\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()
No public properties found
No constants found
updateQuantity()
addItem()
findItem()
validateForm()
propagateFormError()
redirect()
$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

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

validateForm()

validateForm(\Thelia\Form\BaseForm $aBaseForm,  $expectedMethod)

Parameters

\Thelia\Form\BaseForm $aBaseForm
$expectedMethod

redirect()

redirect( $url,  $status)

Parameters

$url
$status

getAddCartForm()

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

Parameters

\Symfony\Component\HttpFoundation\Request $request