public function buy(Delivery $delivery, OrderController $orderController, OrderItemController $orderItemController, SendMailController $sendMailController)
 {
     $products = Input::get('basked');
     $deliveryId = Input::get('deliveryId');
     $deliveryInfo = $delivery->getPriceDelivery($deliveryId);
     $user = Input::get('user');
     $info = $orderController->Order($user, $deliveryInfo, $products, $orderItemController);
     $id = $info['id'];
     Session::forget('product');
     Session::forget('bascedCount');
     $sendMailController->checkMail($user, $info, $deliveryInfo);
     return $id;
 }
 public function orderAdmin()
 {
     $orders = OrderController::listOrderAdmin();
     return view('admin/order/index', array('orders' => $orders));
 }
 public function order()
 {
     $userID = 0;
     $productID = 0;
     $color = "";
     $size = "";
     //$address="";
     Session::forget("address");
     $quantity = 0;
     $address = Input::all();
     if (isset($address["email"])) {
         Session::put("name", $address["name"]);
         $address = serialize($address);
         Session::put("address", $address);
     } else {
         Session::put("order", $_POST["contents"]);
     }
     if (Session::has("cart") && Session::has("order")) {
         $cartArr = Session::get("cart");
         $infoProductArr = Session::get("order");
         if (Session::has("login_name") && Session::has("login_userID")) {
             $userID = Session::get("login_userID");
             $address = "";
         } else {
             if (Session::has("address")) {
                 $address = Session::get("address");
             } else {
                 return -3;
             }
         }
         $order = array("userID" => $userID, "address" => $address);
         $orderid = OrderController::insert($order);
         for ($i = 1; $i < count($cartArr); $i++) {
             $quantity = $infoProductArr["2"][$i - 1];
             $size = $infoProductArr["0"][$i - 1];
             $color = $infoProductArr["1"][$i - 1];
             $productID = $cartArr[$i][0]['id'];
             $detailproduct = array("userID" => $userID, "productID" => $productID, "quantity" => $quantity, "color" => $color, "size" => $size, "orderid" => $orderid);
             DetailOrderController::insert($detailproduct);
         }
         if (Session::has("address")) {
             return $this->orderSuccess();
         }
         $userID = 0;
         $productID = 0;
         $color = "";
         $size = "";
         //$address="";
         Session::forget("address");
         Session::forget("cart");
         Session::forget("order");
         $quantity = 0;
         return 3;
     }
     return -2;
 }
Example #4
0
 public function saveorderall(Request $request)
 {
     $a = $request->all();
     if (!Session::has("orderdmcl")) {
         Session::put("orderdmcl", array());
     }
     if (is_array($a)) {
         foreach ($a as $key => $value) {
             $order = Session::get("orderdmcl");
             if (array_key_exists($value['id'], $order)) {
                 $order[$value['id']]['order']['limit'] = 1;
                 Session::put("orderdmcl", $order);
             } else {
                 $order[$value['id']] = array("order" => array("id" => $value['id'], "supplier" => $value['supplier'], "limit" => 1, "color" => 0), "product" => OrderController::detail_product($value['id'], $value['supplier']));
                 Session::put("orderdmcl", $order);
             }
         }
     }
     return Session::get("orderdmcl");
 }