Exemple #1
0
?>
">
						<option value="none" selected disabled>select a frosting color</option>
						<?php 
echo Cakes::selectOptions(Cakes::$frosting_color_opt);
?>

					</select>

					<select id="cake_flavor" name="cake_flavor" value="<?php 
echo $cake->cake_flavor;
?>
">
						<option value="none" selected disabled>select a cake flavor</option>
						<?php 
echo Cakes::selectOptions(Cakes::$cake_flavor_opt);
?>

					</select>

					<input id="cake" placeholder="input your cake message" name="decor_message" value="<?php 
echo $cake->decor_message;
?>
">
					<input type="submit">

				</form>

			</div>
			
Exemple #2
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);
 }
Exemple #3
0
 public function postAddtocart()
 {
     $cake = Cakes::find(Input::get('id'));
     $quantity = Input::get('quantity');
     $delivery_date = Input::get('delivery_date');
     $price = Input::get('price');
     Cart::insert(array('id' => $cake->id, 'code' => $cake->product_code, 'name' => $cake->title, 'price' => $price, 'quantity' => $quantity, 'vendor_id' => Input::get('vend_id'), 'type' => 'p', 'delivery_date' => $delivery_date, 'image' => $cake->image));
     return Redirect::to('home/cart')->with('purchase_type', 'cake');
 }
    $cakes->save();
    return new JsonResponse($cake);
});
//show a cake
$app->get("/cakes/{id}", function ($id) {
    $cakes = new Cakes();
    return new JsonResponse($cakes->getCake($id));
});
$app->patch("/cakes/{id}/update", function (Request $request, $id) {
    $cakes = new Cakes();
    $oldCake = $cakes->getCake($id);
    if (!$oldCake) {
        return new Response("No cake by id {$id}", 404);
    }
    $newCake = json_decode($request->getContent(), true);
    //    var_dump($newCake, $oldCake);die;
    $cake = array_merge($oldCake, $newCake);
    $cakes->updateCake($id, $cake);
    $cakes->save();
    return new JsonResponse($cake);
});
$app->delete("/cakes/{id}/delete", function ($id) {
    $cakes = new Cakes();
    if (!$cakes->getCake($id)) {
        return new Response("No cake by id {$id}");
    }
    $cakes->deleteCake($id);
    $cakes->save();
    return new Response();
});
$app->run();
Exemple #5
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;
 }
Exemple #6
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);
     }
 }
		      </tbody>
		    </table>
		    <hr>
	  	</div>
		The order has been successfully placed. Thanks for shopping with us.<br/>
		<h5>Billing details : </h5> <br/><br/>
		Order id 		: <?php 
echo $details_for_order['txnid'];
?>
<br/><br/>
		Amount   		: <?php 
echo $details_for_order['subtotal'];
?>
<br/><br/>
		Product info 	: <?php 
echo $info = $details_for_order['udf2'] == 'cake' ? Cakes::getproductdesc($details_for_order['product_id'][0]) : Product::getproductdesc($details_for_order['product_id'][0]);
?>
<br/><br/>
		First name		: <?php 
echo $billing_det['first_name'];
?>
<br/><br/>
		Last name 		: <?php 
echo $billing_det['last_name'];
?>
<br/><br/>
		Address1 		: <?php 
echo $billing_det['address'];
?>
<br/><br/>
		Address2		: <?php