public function addCartWithNumber(Request $request)
 {
     $dish_id = \StringHelper::filterString($request->input('dish_id'));
     $number = \StringHelper::filterString($request->input('number'));
     $dish = DB::table('dish')->where('dish_id', $dish_id)->first();
     $dish_name = $dish->dish_name;
     $dish_price = $dish->dish_price;
     Cart::add(array('id' => $dish_id, 'name' => $dish_name, 'qty' => $number, 'price' => $dish_price));
 }
 /**
  * Returns the biggest discount
  */
 public function testDiscount()
 {
     Cart::add(1, 'ITEM1', 1, '100');
     Cart::addCoupon('TEST20', 10);
     Cart::addCoupon('TEST10', 20);
     Cart::addCoupon('TEST50', 50);
     Cart::addCoupon('TEST40', 30);
     $this->assertEquals(50, Cart::discount());
 }
 public function adiciona(Request $request)
 {
     $produto = Produto::find($request->id);
     if ($produto->quantidade >= $request->quantidade) {
         Cart::add(rand(1, 10000000), $produto->nome, $request->quantidade, $produto->preco, array('size' => 'large'));
         Flash::success("{$produto->nome} adicionado ao Pedido!");
         return redirect()->route('listaprodutos1');
     } else {
         Flash::error("Existem apenas {$produto->quantidade} disponíveis");
         return redirect()->back();
     }
 }
Beispiel #4
0
 public function addToCart(AddToCartRequest $request)
 {
     //get Data
     $data = $request->all();
     $model = new Cd();
     $info = json_decode($model->getDataAProduct($data['id'], Cd::$columnForPage));
     if ($info->quantity - 1 >= 0) {
         Cart::add(['id' => $info->id, 'name' => $info->name, 'qty' => 1, 'price' => $info->sale_off * $info->price * 0.01 + $info->price]);
         return redirect()->back()->with('success', 'Added item!');
     } else {
         return redirect_errors("Sorry we aren't Cd for You");
     }
 }
Beispiel #5
0
 public function addToCart($bookid)
 {
     if (Cart::search(array('id' => $bookid))) {
         \Session::flash('message', 'Already added to Cart');
         \Session::flash('type', 'warning');
     } else {
         $books = \App\Books::where('bookid', $bookid)->where('available', 1)->first();
         Cart::add($books->bookid, $books->bookname, 1, $books->price, array('imageurl' => $books->imageurl));
         session([$bookid => $books]);
         \Session::flash('message', 'Added to Cart!');
         \Session::flash('type', 'success');
     }
     return redirect('/books/' . $bookid);
 }
 public function postCart(Requests\CartRequest $request)
 {
     $products = Product::find(Input::get('id'));
     if (Input::get('qty') > 10) {
         return redirect('store/view/' . $products->id)->with('flash_message', 'Limit 10 Only');
     }
     $id = $products->id;
     $name = $products->title;
     $cat = $products->category_id;
     $qty = Input::get('qty');
     $color = Gambar::find(Input::get('color'));
     $size = Input::get('size');
     $price = $products->price;
     $profit = $products->profit * 0.06;
     $img = Gambar::find(Input::get('color'));
     $data = array('id' => $id, 'name' => $name, 'qty' => $qty, 'price' => $price, 'profit' => $profit, 'options' => array('size' => $size, 'image' => $img->img, 'color' => $color->name, 'img_id' => $img->id, 'cat' => $cat));
     Cart::add($data);
     return redirect('store/cart');
 }
 public function add(array $content)
 {
     return Cart::add($content);
 }
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function addpost(Request $request)
 {
     $product = product::with('images')->find($request->input('id'));
     Cart::add($product->id, $product->name, $request->input('amount'), $product->price, ['size' => $request->input('size'), 'image' => $product->images[0]->image]);
     Session::flash('success', "Het product is toegevoegd aan de winkelwagen");
     return redirect()->back();
 }