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); }
public function postAddtocart() { $product = Product::find(Input::get('id')); $quantity = Input::get('quantity'); $delivery_date = Input::get('delivery_date'); $price = ''; if (isset($_GET['reg'])) { $price = Input::get('reg_price'); } else { if (isset($_GET['dlx'])) { $price = Input::get('dlx_price'); } else { if (isset($_GET['pri'])) { $price = Input::get('prm_price'); } } } Cart::insert(array('id' => $product->id, 'code' => $product->product_code, 'name' => $product->title, 'price' => $price, 'quantity' => $quantity, 'vendor_id' => Input::get('vend_id'), 'type' => 'p', 'delivery_date' => $delivery_date, 'image' => $product->image)); $addons = Input::get('aid'); if (!empty($addons)) { foreach ($addons as $key => $value) { $addon = Addon::find($value); Cart::insert(array('id' => $addon->id, 'name' => $addon->description, 'price' => $addon->price, 'quantity' => $quantity, 'vendor_id' => $addon->vendor_id, 'delivery_date' => $delivery_date, 'type' => 'a', 'image' => $addon->image)); } } return Redirect::to('home/cart')->with('purchase_type', 'flower'); }