refactor update item eventListener

This commit is contained in:
Manuel Raynaud
2013-08-14 15:55:06 +02:00
parent f9b2584485
commit ecb42e906b
5 changed files with 50 additions and 37 deletions

View File

@@ -33,7 +33,7 @@ class CartController extends BaseFrontController
{
use \Thelia\Cart\CartTrait;
public function addArticle()
public function addItem()
{
$request = $this->getRequest();
@@ -67,28 +67,37 @@ class CartController extends BaseFrontController
}
}
public function changeArticle()
public function changeItem()
{
$cartEvent = $this->getCartEvent();
$cartEvent->cartItem = $this->getRequest()->get("cart_item");
$cartEvent->quantity = $this->getRequest()->get("quantity");
$this->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent);
try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent);
$this->redirectSuccess();
} catch(PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
}
$this->redirectSuccess();
}
public function deleteArticle()
public function deleteItem()
{
$cartEvent = $this->getCartEvent();
$cartEvent->cartItem = $this->getRequest()->get("cartItem");
$cartEvent->cartItem = $this->getRequest()->get("cart_item");
try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_DELETEITEM, $cartEvent);
} catch (PropelException $e)
{
$this->redirectSuccess();
} catch (PropelException $e) {
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during deleting cartItem with message : %s", $e->getMessage()));
$this->getParserContext()->setGeneralError($e->getMessage());
}
$this->redirectSuccess();
}
/**