Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addToCart(Disc $disc)
- {
- $getCart = $this->session->get('cart');
- if(isset($getCart[$disc->getId()]))
- {
- $getCart[$disc->getId()]['quantity']++;
- }
- else
- {
- $getCart[$disc->getId()] = array(
- 'quantity' => 1,
- 'title' => $disc->getTitle(),
- 'price' => $disc->getPrice(),
- 'id' => $disc->getId(),
- );
- }
- $this->session->set('cart', $getCart);
- return renderCart();
- }
- public function renderCart()
- {
- $getCart = $this->session->get('cart');
- return $this->render('discs/cart.html.twig', array(
- 'cart' => $getCart
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement