public function postFetchotherven() { $id = $_POST['prod_id']; $product = Product::find($id); $ovid = $product->ovid; $arr = explode(',', $ovid); unset($arr[0]); $str = "<table>"; $str = "<tr><th>Florist</th><th>Price</th></tr>"; foreach ($arr as $key => $value) { $pvrln = Prodvenrelations::find($value); $ven_name = User::fetch_name($pvrln->vendor_id); $str .= "<tr>"; $str .= "<td>" . $ven_name . "</td>"; $str .= "<td>" . $pvrln->regular_price . "</td>"; $str .= "</tr>"; } $str .= "</table>"; return $str; }
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); } }