Browse Source

Frontend : redirection après suppression réduction du panier

feature/export_comptable
Guillaume 4 years ago
parent
commit
f7d6aa2a3a
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      ShopBundle/Controller/Frontend/CartController.php

+ 11
- 2
ShopBundle/Controller/Frontend/CartController.php View File

@@ -62,8 +62,10 @@ class CartController extends BaseController
return new JsonResponse($return) ;
}

public function deleteReductionCart($id)
public function deleteReductionCart(Request $request)
{
$id = $request->get('id') ;

$orderReductionCartRepository = $this->em->getRepository($this->em->getClassMetadata(OrderReductionCartInterface::class)->getName()) ;
$orderReductionCart = $orderReductionCartRepository->findOneById((int) $id) ;

@@ -79,7 +81,14 @@ class CartController extends BaseController
$this->addFlash('error', 'Une erreur est survenue lors de la suppression de la réduction. ') ;
}

return $this->redirectToRoute('frontend_order_cart') ;
$referer = $request->headers->get('referer');

if($referer) {
return $this->redirect($referer);
}
else {
return $this->redirectToRoute('frontend_order_cart');
}
}

}

Loading…
Cancel
Save