clear order and consumed coupon in session after processing order. Fix #162

This commit is contained in:
Manuel Raynaud
2014-01-10 14:55:52 +01:00
parent 9d0121f321
commit 3121fc4f5f
3 changed files with 24 additions and 1 deletions

View File

@@ -263,6 +263,8 @@ class Coupon extends BaseAction implements EventSubscriberInterface
$orderCoupon->save();
}
}
$request->getSession()->setConsumedCoupons(array());
}
/**

View File

@@ -287,7 +287,8 @@ class Order extends BaseAction implements EventSubscriberInterface
$sessionOrder = new \Thelia\Model\Order();
$event->setOrder($sessionOrder);
$event->setPlacedOrder($placedOrder);
$this->getSession()->setOrder($placedOrder);
$this->getSession()->setProcessedOrder($placedOrder);
$this->getSession()->setOrder(new \Thelia\Model\Order());
/* empty cart */
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));

View File

@@ -253,6 +253,26 @@ class Session extends BaseSession
return $this->get("thelia.order");
}
/**
* @param Order $order
* @return $this
*/
public function setProcessedOrder(Order $order)
{
$this->set('thelia.order.processed', $order);
return $this;
}
/**
* Return an order already processed, usefull for payment modules
* @return Order
*/
public function getProcessedOrder()
{
return $this->get('thelia.order.processed');
}
/**
* Set consumed coupons by the Customer
*