src/Flexy/FrontBundle/Themes/CoWorking/Controller/CartController.php line 41
<?phpnamespace App\Flexy\FrontBundle\Themes\CoWorking\Controller;use App\Flexy\FrontBundle\Themes\CoWorking\Service\ShoppingCartService;use App\Flexy\ProductBundle\Repository\ProductRepository;use App\Flexy\ShopBundle\Entity\Product\ProductShop;use App\Flexy\ShopBundle\Repository\Customer\CustomerRepository;use App\Flexy\ShopBundle\Repository\Shipping\CityRegionRepository;use App\Flexy\ShopBundle\Repository\Shipping\ShippingMethodRepository;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;#[Route('/shop/cart')]class CartController extends AbstractController{#[Route('/', name: 'cart')]public function cart(ShippingMethodRepository $shippingMethodRepository,CustomerRepository $customerRepository,CityRegionRepository $cityRegionRepository): Response{$shippingMethods = $shippingMethodRepository->findAll();$cityRegions = $cityRegionRepository->findAll();$customer = null;if($this->getUser()){$customer = $customerRepository->findOneBy(["user"=>$this->getUser()]);}return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/cart.html.twig',["shippingMethods"=>$shippingMethods,"customer"=>$customer,"totalCart"=>160,"cityRegions"=>$cityRegions]);}#[Route('/ajax/cart', name: 'ajax_cart')]public function ajax_cart(ShoppingCartService $shoppingCartService,Request $request): Response{if($request->query->get("idProduct")){if($request->query->get("actionType") == "add"){//$shoppingCartService->addItem(['id' => $request->query->get("idProduct"),'name' => $request->query->get("name"),'price' => $request->query->get("price"),'image' => $request->query->get("image"),'quantity' => 1,],false);}else{$shoppingCartService->removeItem($request->query->get("idProduct"));}}return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/_ajaxCart.html.twig');}#[Route('/ajax/cart/update', name: 'ajax_cart_update')]public function ajax_car_update(ShoppingCartService $shoppingCartService,Request $request): Response{if ($request->query->get("actionType") == "update") {$idProduct = $request->query->get("idProduct");$name = $request->query->get("name");$subcategory = $request->query->get("cat");$shoppingCartService->updateName($idProduct, $name ,$subcategory);}return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/_ajaxCart.html.twig');}#[Route('/wishlist', name: 'wishlist')]public function wishlist(): Response{return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/wishlist.html.twig');}#[Route('/compare', name: 'compare')]public function compare(): Response{return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/compare.html.twig');}#[Route('/show-devis', name: 'show_devis')]public function show_devis(): Response{return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/cart/showDevis.html.twig');}}