$container
$container : \Thelia\Action\The
Class Cart where all actions are manage like adding, modifying or delete items.
Class Cart
addItem(\Thelia\Core\Event\CartEvent $event)
add an article in the current cart
| \Thelia\Core\Event\CartEvent | $event |
deleteItem(\Thelia\Core\Event\CartEvent $event)
Delete specify article present into cart
| \Thelia\Core\Event\CartEvent | $event |
changeItem(\Thelia\Core\Event\CartEvent $event)
Modify article's quantity
don't use Form here just test the Request.
| \Thelia\Core\Event\CartEvent | $event |
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:
For instance:
The event names to listen to
updateQuantity(\Thelia\Model\CartItem $cartItem, float $quantity)
increase the quantity for an existing cartItem
| \Thelia\Model\CartItem | $cartItem | |
| float | $quantity |
doAddItem(\Thelia\Model\Cart $cart, int $productId, int $productSaleElementsId, float $quantity, \Thelia\Model\ProductPrice $productPrice)
try to attach a new item to an existing cart
| \Thelia\Model\Cart | $cart | |
| int | $productId | |
| int | $productSaleElementsId | |
| float | $quantity | |
| \Thelia\Model\ProductPrice | $productPrice |
findItem(int $cartId, int $productId, int $productSaleElementsId) : \Thelia\Action\ChildCartItem
find a specific record in CartItem table using the Cart id, the product id and the product_sale_elements id
| int | $cartId | |
| int | $productId | |
| int | $productSaleElementsId |
validateForm(\Thelia\Form\BaseForm $aBaseForm, string $expectedMethod) : \Symfony\Component\Form\Form
Validate a BaseForm
| \Thelia\Form\BaseForm | $aBaseForm | the form |
| string | $expectedMethod | the expected method, POST or GET, or null for any of them |
is the form contains error, or the method is not the right one
Form the symfony form object
propagateFormError(\Thelia\Form\BaseForm $aBaseForm, string $error_message, \Thelia\Core\Event\ActionEvent $event)
Propagate a form error in the action event
| \Thelia\Form\BaseForm | $aBaseForm | the form |
| string | $error_message | an error message that may be displayed to the customer |
| \Thelia\Core\Event\ActionEvent | $event | the action event |