Ejemplo n.º 1
0
 public function getView($order_id)
 {
     $order = Order::where('order_id', '=', $order_id)->get()->toArray();
     //		$order_master = Ordermaster::where('order_id','=',$order_id)->get()->toArray();
     if ($order[0]['type'] == "cake") {
         $prod_details = Cakes::where('id', '=', $order[0]['product_id'])->get(array('image', 'title', 'description'))->toArray();
     } else {
         $prod_details = Product::where('id', '=', $order[0]['product_id'])->get(array('image', 'title', 'description'))->toArray();
     }
     $order_addon_id = $order[0]['add_on_id'];
     $addon_det = array();
     if ($order_addon_id != "") {
         $order_addons = explode(',', $order_addon_id);
         foreach ($order_addons as $k => $v) {
             $temp = Addon::find($v)->toArray();
             array_push($addon_det, $temp);
         }
     }
     $order[0]['prod_details'] = $prod_details[0];
     //		$order[0]['master_details'] = $order_master[0];
     return View::make('orders.view')->with('order', $order[0])->with('addon_det', $addon_det);
 }
Ejemplo n.º 2
0
 public static function getproductdesc($id)
 {
     $description = Cakes::where('id', '=', $id)->get(array('title', 'description'))->toArray();
     $desc = $description[0]['title'] . " " . $description[0]['description'];
     return $desc;
 }
Ejemplo n.º 3
0
 public function getView($id)
 {
     $cake = Cakes::where('id', '=', $id)->get()->toArray();
     return View::make('cake.view')->with('cake', $cake[0]);
 }
Ejemplo n.º 4
0
 public function getSendtocity()
 {
     $city = "";
     $sendtype = "";
     //Set type session
     if (Input::has('sendtype')) {
         $sendtype = Input::get('sendtype');
         Session::put('sendtype', $sendtype);
     }
     if (Session::has('sendtype')) {
         $sendtype = Session::get('sendtype');
     }
     //Set flowers session
     if (Input::has('sendtocity')) {
         $city = Input::get('sendtocity');
         Session::put('city', $city);
     }
     if (Session::has('city')) {
         $city = Session::get('city');
     }
     // Pagination calulation
     $perPage = 8;
     if (isset($_GET['page'])) {
         $currentPage = $_GET['page'] - 1;
     } else {
         $currentPage = 0;
     }
     if ($sendtype == 'flower') {
         $products1 = Product::where('city', 'like', '%' . $city . '%')->get()->toArray();
         $products2 = Prodvenrelations::where('city', 'like', '%' . $city . '%')->get()->toArray();
         if (!empty($products2)) {
             foreach ($products2 as $key => $value) {
                 $parent_prod = Product::find($value['product_id'])->toArray();
                 $products2[$key]['id'] = $parent_prod['id'];
                 $products2[$key]['image'] = $parent_prod['image'];
                 $products2[$key]['title'] = $parent_prod['title'];
             }
         }
         $products = array_merge($products1, $products2);
         $pagedData = array_slice($products, $currentPage * $perPage, $perPage);
         $links = Paginator::make($products, count($products), $perPage);
         return View::make('home.sendtocity')->with('products', $pagedData)->with('city_to_go', $city)->with('links', $links)->with('city_list', City::all());
     } else {
         $category_selected = "all";
         $cakes = Cakes::where('city', '=', $city)->get()->toArray();
         $tmp = array();
         foreach ($cakes as $arg) {
             $tmp[$arg['title']][] = $arg;
         }
         $cakes = $tmp;
         $pagedData = array_slice($cakes, $currentPage * $perPage, $perPage);
         $links = Paginator::make($cakes, count($cakes), $perPage);
         return View::make('cake.index')->with('category_selected', $category_selected)->with('city_list', City::all())->with('cakes', $pagedData)->with('links', $links)->with('city_to_go', $city)->with('tocity', $city);
     }
 }