Exemplo n.º 1
0
 public function postDelete()
 {
     if (Request::ajax()) {
         $productId = Input::get('productId');
         $rows = Cart::search(array('id' => $productId));
         $rowId = $rows[0];
         Cart::update($rowId, 0);
         $total = Cart::total();
         return Response::json(array('productId' => $productId, 'quantity' => $quantity, 'total' => $total));
     }
 }
Exemplo n.º 2
0
 public function make($shipping, $coupon = null, $admin = null)
 {
     $user = $this->user->find(\Auth::user()->id);
     $commande = ['user_id' => $user->id, 'order_no' => $this->order->newOrderNumber(), 'amount' => \Cart::total() * 100, 'coupon_id' => $coupon ? $coupon['id'] : null, 'shipping_id' => $shipping->id, 'payement_id' => 1, 'products' => $this->productIdFromCart()];
     // Order global
     $order = $this->insertOrder($commande);
     // Create invoice for order
     $job = new CreateOrderInvoice($order);
     $this->dispatch($job);
     return $order;
 }
Exemplo n.º 3
0
 public function process()
 {
     $factura = new Factura();
     $factura->usuario_id = Auth::user()->id;
     $factura->total = Cart::total();
     foreach (Cart::content() as $item) {
         if (Item::find($item['id'])->stock == 0) {
             Session::flash('error', 'El item ' . $item['name'] . ' se ha agotado');
             return Redirect::back();
         }
         if (Item::find($item['id'])->stock - $item['qty'] < 0) {
             Session::flash('error', 'No hay suficiente stock del item ' . $item['name'] . ' para cubrir su pedido');
             return Redirect::back();
         }
     }
     if ($factura->save()) {
         foreach (Cart::content() as $item) {
             $detalle = new Detalle();
             $detalle->factura_id = $factura->id;
             $detalle->item_id = $item['id'];
             $detalle->cantidad = $item['qty'];
             if ($detalle->save()) {
                 $deduct = Item::find($item['id']);
                 $deduct->stock -= $item['qty'];
                 $deduct->save();
             } else {
                 Session::flash('error', 'Error al procesar');
                 return Redirect::back();
             }
         }
     } else {
         Session::flash('error', 'Error al procesar');
         return Redirect::back();
     }
     Cart::destroy();
     return Redirect::to('shop');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $carts = Cart::content();
     if (Cart::count() < 1) {
         Session::flash('flash_error', 'You need add at least one product!');
     }
     $order = new Order();
     $order->user_id = Auth::user()->id;
     $order->date = date('Y-m-d h:i:s');
     $order->total = money_format('%.2n', Cart::total());
     $order->save();
     foreach ($carts as $row) {
         $product = Product::find($row->id)->firstOrFail();
         $orderDetail = new OrderDetail();
         $orderDetail->order_id = $order->id;
         $orderDetail->product_id = $product->code;
         $orderDetail->quantity = $row->qty;
         $orderDetail->sub_total = money_format('%.2n', $row->subtotal);
         $orderDetail->save();
         Cart::destroy();
     }
     Session::flash('message', 'Successfully created order!');
     return Redirect::to('orders');
 }
Exemplo n.º 5
0
                      </p>
                  </td>
                  <td>$<?php 
echo $row->subtotal;
?>
</td>
             </tr>
          @endforeach

          <tr>
              <td>SUBTOTAL</td>
              <td><?php 
echo '$' . Cart::total();
?>
</td>
          </tr>

          <tr>
            <td><strong>TOTAL</strong></td>
            <td style="color:#f7941d;"><strong><?php 
echo '$' . Cart::total();
?>
</strong></td>
          </tr>

      </table>
  </div>
</div>

@stop
Exemplo n.º 6
0
 /**
  * @dataProvider containsData
  */
 public function testTotal($products, $total)
 {
     $cart = new \Cart();
     $cart->add($products);
     $this->assertEquals($cart->total(), $total);
 }
 /**
 * Display the specified resource.
 * GET /payment/{id}
 *
 * @param  int  $id
 * @return Response
 */
 public function receipt($id)
 {
     setlocale(LC_MONETARY, "en_US");
     $user = Auth::user();
     $fee = Cart::total() / getenv("SV_FEE") - Cart::total();
     $total = $fee + Cart::total();
     return View::make('emails.receipt.default')->with('page_title', 'Payment Complete')->withUser($user)->with('products', Cart::contents())->with('service_fee', $fee)->with('cart_total', $total);
 }
Exemplo n.º 8
0
 public function totalCart()
 {
     return \Cart::total();
 }
Exemplo n.º 9
0
 public function updateQuantity()
 {
     $row_id = Input::get('row_id');
     $qty = Input::get('qty');
     Cart::update($row_id, $qty);
     $cart_row = Cart::get($row_id);
     $order_type = $cart_row->options->order_type;
     $sku = $cart_row->options->sku;
     $size = $cart_row->options->size;
     $sizes = explode("|", $size);
     $product = new VIImage();
     $product->sku = $sku;
     $product->sizew = $sizes[0];
     $product->sizeh = $sizes[1];
     foreach ($cart_row->options->options as $option) {
         if ($option['type_key'] == 'depth') {
             $product->bleed = floatval($option['value']);
         } else {
             $product->{$option}['type_key'] = floatval($option['value']);
         }
     }
     $product->quantity = $qty;
     // echo '<pre>';
     // print_r($product);
     // echo '</pre>';
     $price = JTProduct::getPrice($product);
     Cart::update($row_id, ['price' => $price['sell_price']]);
     $cart_row = Cart::get($row_id);
     $cart_total = Cart::total();
     $data = ['cart_row' => $cart_row, 'cart_total' => $cart_total];
     if (Request::ajax()) {
         return Response::json(['result' => 'ok', 'data' => $data]);
     }
     return Redirect::route('order-cart');
 }
 public function PaymentCreateTeam($club, $id)
 {
     $user = Auth::user();
     $club = Club::find($club);
     $team = Team::find($id);
     $cart = Cart::contents();
     $uuid = Uuid::generate();
     //Addition for stub feature
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     foreach (Cart::contents() as $item) {
         //check if selected team equal team in cart
         if ($id != $item->team_id) {
             return Redirect::action('ClubPublicController@teamSingle', array($club->id, $team->id));
         }
         $player = Player::Find($item->player_id);
     }
     $discount = Session::get('discount');
     if (!$discount) {
         $discount = 0;
     }
     $discount = $discount['percent'] * Cart::total();
     $subtotal = Cart::total() - $discount;
     $taxfree = Cart::total(false) - $discount;
     $fee = $subtotal / getenv("SV_FEE") - $subtotal;
     $tax = $subtotal - $taxfree;
     $total = $fee + $tax + $subtotal;
     if (!$total) {
         foreach (Cart::contents() as $item) {
             $member = new Member();
             $member->id = $uuid;
             $member->firstname = $player->firstname;
             $member->lastname = $player->lastname;
             $member->due = $team->getOriginal('due');
             $member->early_due = $team->getOriginal('early_due');
             $member->early_due_deadline = $team->getOriginal('early_due_deadline');
             $member->plan_id = null;
             $member->player_id = $player->id;
             $member->team_id = $item->team_id;
             $member->accepted_on = Carbon::Now();
             $member->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $member->accepted_user = $user->id;
             $member->method = $item->type;
             $member->status = 1;
             $member->save();
             //waitlist process
             if ($team->max < $team->members->count()) {
                 //add to waitlist
                 $waitlist = new Waitlist();
                 $waitlist->id = Uuid::generate();
                 $waitlist->member_id = $uuid;
                 $waitlist->team_id = $team->id;
                 $waitlist->save();
             }
         }
         //send email notification of acceptance
         $data = array('club' => $club, 'player' => $player, 'user' => $user, 'member' => $member);
         $mail = Mail::send('emails.notification.accept', $data, function ($message) use($user, $club, $member) {
             $message->from('*****@*****.**', 'C2C Lacrosse')->to($user->email, $member->accepted_by)->subject("Thank you for joining our team | " . $club->name);
             foreach ($club->users()->get() as $value) {
                 $message->bcc($value->email, $club->name);
             }
         });
         $vault = false;
         Cart::destroy();
         return View::make('app.public.club.team.free')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('team', $team)->with('products', $cart)->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
         // return "You've been added to the team for free, please close this window to complete transaction";
         // return Redirect::action('ClubPublicController@selectTeamPlayer', array($club->id, $team->$id));
     }
     /**********************/
     //stub temporary fix for parent that like to sign up for an event team in a different club with a saved customer id
     //check if user is follower of the club hosting the team.
     if ($follow->club_id != $club->id) {
         $vault = false;
         return View::make('app.public.club.team.checkoutWithoutVault')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('team', $team)->with('products', $cart)->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
     }
     /*******************************/
     if ($user->profile->customer_vault) {
         $param = array('report_type' => 'customer_vault', 'customer_vault_id' => $user->profile->customer_vault, 'club' => $club->id);
         $payment = new Payment();
         $vault = $payment->ask($param);
         return View::make('app.public.club.team.checkoutVault')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('team', $team)->with('products', $cart)->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
     } else {
         $vault = false;
         return View::make('app.public.club.team.checkout')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('team', $team)->with('products', $cart)->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
     }
 }
Exemplo n.º 11
0
</span>
				<a href="<?php 
    echo URL::to('cart/update/' . $row->id, $row->qty + 1);
    ?>
" class="btn btn-default btn-sm">+</a>
			</div>
		</td>
		<td><?php 
    echo price($row->totalPrice);
    ?>
</td>
	</tr>
	<?php 
}
?>
	<tr>
		<td colspan="4" class="text-right">
		<td>
			<strong>Итого <?php 
echo price(Cart::total());
?>
</strong>
		</td>
	</tr>
</table>

<hr>
<a href="<?php 
echo URL::to('cart/checkout');
?>
" class="btn btn-primary pull-right">Оформление заказа</a>
Exemplo n.º 12
0
 public function postPaymentsuccess()
 {
     $order_info = (array) json_decode($_COOKIE['orderdetails']);
     $order_id = $order_info['txnid'];
     $product_id = implode(',', $order_info['product_id']);
     $product_quantity = implode(',', $order_info['product_quantity']);
     $product_vendor_id = implode(',', $order_info['product_vendor_id']);
     $shipping_det = (array) $order_info['shipping'];
     $billing_det = (array) $order_info['billing'];
     if (isset($order_info['addon_vendor_id'])) {
         $add_on_id = implode(',', $order_info['addon_id']);
     }
     // Saving to order table
     $order = new Order();
     $order->order_id = $order_id;
     $order->user_id = $order_info['user_id'];
     $order->product_id = $product_id;
     if (isset($add_on_id)) {
         $order->add_on_id = $add_on_id;
     }
     $order->vendor_id = $order_info['udf2'] == 'cake' ? User::cakegetid($product_vendor_id) : $product_vendor_id;
     $order->name = $shipping_det['first_name'] . " " . $shipping_det['last_name'];
     $order->contact = $shipping_det['mobile'];
     $order->shipping_address = $shipping_det['address'] . " " . $shipping_det['address2'];
     $order->shipping_city = $shipping_det['scity'];
     $order->shipping_zip = $shipping_det['zip_code'];
     $order->shipping_state = $shipping_det['state'];
     $order->price = $order_info['subtotal'];
     $order->disc_code = $order_info['coupon'];
     $order->status = 'neworder';
     $order->type = $order_info['udf2'];
     $order->user_message = $order_info['personalmessage'];
     $order->delivery_date = $order_info['delivery_date'];
     $order->payment_clearance = 'uncleared';
     $order->quantity = $product_quantity;
     // Saving to order master table
     $ordermaster = new Ordermaster();
     $ordermaster->order_id = $order_id;
     $ordermaster->transaction_id = 0;
     $ordermaster->payment_method = 'others';
     $ordermaster->name = $shipping_det['first_name'] . " " . $shipping_det['last_name'];
     $ordermaster->contact = $shipping_det['mobile'];
     $ordermaster->billing_address = $billing_det['address'] . " " . $billing_det['address2'];
     $ordermaster->billing_city = $billing_det['bcity'];
     $ordermaster->billing_zip = $billing_det['zip_code'];
     $ordermaster->billing_state = $billing_det['state'];
     $ordermaster->bill_value = $order_info['subtotal'];
     $ordermaster->status = 'uncleared';
     $ordermaster->email = $billing_det['email'];
     $ordermaster->process = 'new';
     //  Saving order details
     if ($order->save() && $ordermaster->save()) {
         // Set for Rating
         $det = Cart::contents();
         $vendor_id = $order_info['udf2'] == 'cake' ? User::cakegetid($product_vendor_id) : $product_vendor_id;
         if (Auth::check()) {
             $user_id = Auth::user()->id;
         } else {
             $user_id = uniqid();
         }
         $ordrid = $order_info['txnid'];
         foreach ($det as $item) {
             $vendor_id = $item->vendor_id;
         }
         if ($vendor_id != "") {
             setcookie("ratevendor[vendor_id]", $vendor_id, time() + 60 * 60 * 24 * 30, '/');
             setcookie("ratevendor[user_id]", $user_id, time() + 60 * 60 * 24 * 30, '/');
             setcookie("ratevendor[ordrid]", $ordrid, time() + 60 * 60 * 24 * 30, '/');
         }
         // Set for Rating
         $products = Cart::contents();
         $total = Cart::total();
         Cart::destroy();
         $billing_det = (array) $order_info['billing'];
         // Notify user for successfull payment
         Mail::send('emails.orderconfirm', array('details_for_order' => $order_info, 'products' => $products, 'total' => $total), function ($message) use($order_info, $billing_det) {
             $message->from('*****@*****.**', 'Funfest');
             $message->subject('RE: Order successful, Funfest order no. ' . $order_info['txnid']);
             $message->to($billing_det['email']);
         });
         $vendor_email = User::getemail($vendor_id);
         $vendor_email = "*****@*****.**";
         if ($vendor_email != "") {
             Mail::send('emails.vendornotify', array('details_for_order' => $order_info, 'products' => $products, 'total' => $total), function ($message) use($order_info, $billing_det, $vendor_email) {
                 $message->from('*****@*****.**', 'Funfest');
                 $message->subject('RE: Order successful, Funfest order no. ' . $order_info['txnid']);
                 $message->to($vendor_email);
                 //->cc('*****@*****.**');
             });
         } else {
             Mail::send('emails.vendornotify', array('details_for_order' => $order_info, 'products' => $products, 'total' => $total), function ($message) use($billing_det) {
                 $message->from('*****@*****.**', 'Funfest');
                 $message->subject('RE: Order for cake (vendor email was null).');
                 $message->to('*****@*****.**');
             });
         }
         // Send messgae to user
         $username = "******";
         $password = "******";
         $url = "http://smslane.com/vendorsms/pushsms.aspx?user="******"&password="******"&msisdn=91" . $order_info['phone'] . "&sid=WebSms&msg=Your order has been placed successfully. Your order id is " . $order_info['txnid'] . "&fl=1";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $response = curl_exec($ch);
         // Send messgae to vendor
         $vendor_rmn = User::getrmn($product_vendor_id);
         if ($vendor_rmn != "") {
             $username = "******";
             $password = "******";
             $url = "http://smslane.com/vendorsms/pushsms.aspx?user="******"&password="******"&msisdn=91" . $vendor_rmn . "&sid=WebSms&msg=You received a new order, order id " . $order_info['txnid'] . ". Please login to the website to get the details.&fl=1";
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             $response = curl_exec($ch);
         }
         Ordermaster::where('order_id', '=', $_POST['txnid'])->update(array('transaction_id' => $_POST['mihpayid'], 'bank_transaction_id' => $_POST['bank_ref_num'], 'status' => 'cleared', 'process' => 'initiate'));
         Order::where('order_id', '=', $_POST['txnid'])->update(array('status' => 'neworder', 'process' => 'initiate', 'payment_clearance' => 'cleared'));
         return View::make('/home/thankyou')->with('purchase_data', $_POST)->with('message', "The transaction was successful, your order is on it's way.");
     }
 }
Exemplo n.º 13
0
 /**
  * @return void
  */
 public function testCalculPriceWithFirstAndSecondCoupon()
 {
     $worker = \App::make('App\\Droit\\Shop\\Cart\\Worker\\CartWorkerInterface');
     $oneproduct = factory(App\Droit\Shop\Product\Entities\Product::class)->make();
     $onecoupon = factory(App\Droit\Shop\Coupon\Entities\Coupon::class, 'one')->make();
     \Cart::instance('newInstance');
     // Has to match the factory product
     \Cart::add(100, 'Dos', 1, '10.00', array('weight' => 600));
     $this->coupon->shouldReceive('findByTitle')->once()->andReturn($onecoupon);
     $this->product->shouldReceive('find')->twice()->andReturn($oneproduct);
     $worker->setCoupon($onecoupon->title)->applyCoupon();
     // Product price => 10.00
     // Coupon for product value 10%
     $this->assertEquals(9, \Cart::total());
     // Add free shipping later for example via admin
     $this->withSession(['noShipping']);
     $worker->setShipping();
     $this->assertEquals(0, $worker->orderShipping->price);
 }
Exemplo n.º 14
0
 public function checkout()
 {
     $carts = Cart::content();
     if (Cart::total() == 0) {
         return Redirect::to('store')->with('message', 'aw i am sorry, you cannot');
     }
     $bank = ["BCA", "Mandiri", "BNI", "Muamalat"];
     return View::make('store.checkout', compact('carts', 'bank'));
 }
Exemplo n.º 15
0
 public function getRefresh()
 {
     if (Request::ajax()) {
         $item_id = Input::get('item_id');
         $id = Input::get('id');
         $qty = Input::get('qty');
         $talla = Input::get('talla');
         $color = Input::get('color');
         $misc = Misc::where('item_talla', '=', $talla)->where('item_id', '=', $item_id)->where('item_color', '=', $color)->pluck('item_stock');
         if ($misc < $qty) {
             return Response::json(array('type' => 'danger'));
         }
         $cart = Cart::get($id);
         Cart::update($id, $qty);
         $count = Cart::count();
         $total = Cart::total();
         return Response::json(array('type' => 'success', 'count' => $count, 'total' => $total, 'qty' => $cart->qty, 'id' => $cart->id, 'subtotal' => $cart->subtotal));
     }
 }
Exemplo n.º 16
0
 function createOrder()
 {
     $user_id = 0;
     if (Auth::user()->check()) {
         $user_id = Auth::user()->get()->id;
     }
     //Add billing address
     $billing_address = array();
     if (Session::has('billing_address')) {
         $billing_address = Session::get('billing_address');
         $billing_address['user_id'] = $user_id;
         $billing_address['country_name'] = Address::countryName($billing_address['country_a2']);
         if (!empty($billing_address['state_a2'])) {
             $billing_address['state_name'] = Address::stateName($billing_address['state_a2'], $billing_address['country_a2']);
         }
         $billing_address['is_billing'] = 1;
         $obj_billing_address = $this->createAddress($billing_address);
     }
     //add shipping address
     $shipping_address = array();
     if (Session::has('shipping_address')) {
         $shipping_address = Session::get('shipping_address');
         $shipping_address['user_id'] = $user_id;
         $shipping_address['country_name'] = Address::countryName($shipping_address['country_a2']);
         if (!empty($shipping_address['state_a2'])) {
             $shipping_address['state_name'] = Address::stateName($shipping_address['state_a2'], $shipping_address['country_a2']);
         }
         $shipping_address['is_billing'] = 0;
         $obj_shipping_address = $this->createAddress($shipping_address);
     }
     if (isset($obj_billing_address) && isset($obj_shipping_address)) {
         //Add to order table
         $cart_total = Cart::total();
         $order = Order::create(["user_id" => $user_id, "sum_amount" => $cart_total, "billing_address_id" => $obj_billing_address->id, "shipping_address_id" => $obj_shipping_address->id, "status" => "New"]);
         //Add to order_details
         if ($order) {
             $cart_content = Cart::content();
             foreach ($cart_content as $item) {
                 $options = [];
                 foreach ($item->options->options as $option) {
                     $options[] = $option['key'];
                 }
                 $option_keys = implode(",", $options);
                 $orderDetail = OrderDetail::create(["order_id" => $order->id, "image_id" => $item->id, "quantity" => $item->qty, "sell_price" => $item->price, "sum_amount" => $item->subtotal, "type" => $item->options->order_type, "size" => $item->options->size, "option" => $option_keys]);
             }
             //Clear session
             Cart::destroy();
             Session::forget('billing_address');
             Session::forget('shipping_address');
             return $order;
         }
     }
     return false;
 }
 public function paymentCreate($id)
 {
     $user = Auth::user();
     $participant = Participant::find($id);
     $title = 'League Together - ' . $participant->event->club->name . ' Teams';
     $player = $participant->player;
     $club = $participant->event->club;
     $cart = Cart::contents(true);
     //Addition for stub feature
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     foreach (Cart::contents() as $item) {
         $type = $item->type;
     }
     $discount = Session::get('discount');
     if (!$discount) {
         $discount = 0;
     }
     $discount = $discount['percent'] * Cart::total();
     $subtotal = Cart::total() - $discount;
     $taxfree = Cart::total(false) - $discount;
     $fee = $subtotal / getenv("SV_FEE") - $subtotal;
     $tax = $subtotal - $taxfree;
     $total = $fee + $tax + $subtotal;
     switch ($type) {
         case 'full':
             /**********************/
             //stub temporary fix for parent that like to sign up for an event team in a different club with a saved customer id
             //check if user is follower of the club hosting the team.
             if ($follow->club_id != $club->id) {
                 $vault = false;
                 return View::make('app.club.event.participant.checkout.fullWithoutVault')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('participant', $participant)->with('products', Cart::contents())->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
             }
             /*******************************/
             if ($user->profile->customer_vault) {
                 $param = array('report_type' => 'customer_vault', 'customer_vault_id' => $user->profile->customer_vault, 'club' => $club->id);
                 $payment = new Payment();
                 $vault = $payment->ask($param);
                 return View::make('app.club.event.participant.checkout.fullVault')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('participant', $participant)->with('products', Cart::contents())->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
             } else {
                 $vault = false;
                 return View::make('app.club.event.participant.checkout.full')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('participant', $participant)->with('products', Cart::contents())->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
             }
         case 'plan':
             if ($user->profile->customer_vault) {
                 $param = array('report_type' => 'customer_vault', 'customer_vault_id' => $user->profile->customer_vault, 'club' => $club->id);
                 $payment = new Payment();
                 $vault = $payment->ask($param);
                 return View::make('app.club.event.participant.checkout.planVault')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('participant', $participant)->with('products', Cart::contents())->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('today', Carbon::now())->with('player', $player);
             } else {
                 $vault = false;
                 return View::make('app.club.event.participant.checkout.plan')->with('page_title', 'Checkout')->withUser($user)->with('club', $club)->with('participant', $participant)->with('products', Cart::contents())->with('subtotal', $subtotal)->with('service_fee', $fee)->with('tax', $tax)->with('cart_total', $total)->with('discount', $discount)->with('vault', $vault)->with('player', $player);
             }
         default:
             return Redirect::action('ParticipantController@paymentSelect', array($participant->id))->with('error', 'Opps we are having some trouble processing your request, please try later. Error# 345');
     }
     return View::make('app.club.event.participant.payment')->with('page_title', $title)->with('participant', $participant)->withUser($user);
 }
Exemplo n.º 18
0
            </li>
            <li class="list-group-item">
              Shippping
              <span class="badge"><em>
                <!-- shipping count start -->
                  {{ '$'.$cost }}
                <!-- shipping count end -->
              </em></span>
            </li>

        	   <li class="list-group-item">
              <strong>TOTAL</strong>
            </li>
            <li class="list-group-item" style="color:#f7941d; text-align:right">
              <h4><strong><?php 
echo "\$" . $cost + Cart::total();
?>
</strong></h4>
            </li>
        </ul>
        <div class="list-group" id="cartlistnav">
        	<button type="submit" class="list-group-item" style="text-align: left;">Update Cart</button>
          <a  href="{{ url('cart/billing') }}" type="button" class="list-group-item">Proceed To Checkout</a>
        </div>


      </div>
      <div class="col-md-2"></div>
    </div>
  </form>
  <style media="screen">
Exemplo n.º 19
0
            <!-- Shop Products Table -->
            <table class="shop_table beta-shopping-cart-table" cellspacing="0">
                <thead>
                <tr>
                    <th class="product-name">Product</th>
                    <th class="product-price">Price</th>
                    <th class="product-status">Status</th>
                    <th class="product-quantity">Qty.</th>
                    <th class="product-subtotal">Total</th>
                    <th class="product-remove">Remove</th>
                </tr>
                </thead>
                <tbody>
                <?php 
$content = Cart::content();
$total = Cart::total();
$itemHtml = "";
if ($content) {
    $x = 1;
    foreach ($content as $itemRow) {
        if (public_path()) {
            $source_folder = public_path() . '/uploads/images/';
            $destination_folder = public_path() . '/uploads/images/';
        } else {
            $source_folder = '/home/medicalng/public_html/uploads/images/';
            $destination_folder = '/home/medicalng/public_html/uploads/images/';
        }
        $product = Product::find($itemRow->id);
        $image_info = pathinfo($source_folder . $product->image);
        $image_extension = strtolower($image_info["extension"]);
        //image extension
Exemplo n.º 20
0

          <tr id="sublist">
            <td></td>
          </tr>
          <tr id="sublist">
            <td></td>
          </tr>
          <tr id="sublist">
            <td></td>
          </tr>
          <tr>
            <td>SUBTOTAL</td>
              <td></td>
              <td>$<span id="order-subtotal"><?php 
echo Cart::total();
?>
</span></td>
          </tr>
          <tr>
            <td>SHIPPING</td>
              <td></td>
              <td>$<span id="order-shipping">{{ $shipping }}</span></td>
          </tr>
          <tr>
            <td><strong>TOTAL</strong></td>
              <td></td>
              <td style="color:#f7941d;"><strong>$<span id="order-total" >{{ $shipping+Cart::total() }}<span></strong></td>
          </tr>
      </tbody>
  </table>
Exemplo n.º 21
0
 public function action_cart_info()
 {
     $out = array();
     $out['total'] = \Cart::total();
     $out['item_count'] = \Cart::itemCount();
     $out['items'] = count(\Cart::items());
     echo json_encode($out);
     exit;
 }
Exemplo n.º 22
0
$cart->restore($apple);
var_dump($cart->total());
$cart->reset();
var_dump($cart->total());
/* ------------------------------------------------- *\
    DBStorage
\* ------------------------------------------------- */
unset($cart);
exec('sh ./install.sh');
$conn = new Connect(['host' => 'localhost', 'dbname' => 'db_biocoop', 'username' => 'tony', 'password' => 'tony']);
$dbStorage = new DBStorage('products', $conn->getDB());
$cart = new Cart($dbStorage);
$cart->buy($apple, 10);
$cart->buy($raspberry, 10);
$cart->buy($strawberry, 10);
var_dump($cart->total());
//$cart->restore($apple);
var_dump($cart->total());
//$cart->reset();
var_dump($cart->total());
// cart uri
//$productsCart = $cart->getCart();
//
//foreach($productsCart as $p)
//{
//    $product = new Product($p->name, $p->price);
//
//    $quantity = ceil($p->total/$product->price);
//
//    echo "total price : {$p->total}, price HT {$product->price}, price TTC {$product->priceTTC()}, quantity $quantity";
//}
Exemplo n.º 23
0
<?php

header('Content-Type: application/json');
include "../addStore.php";
include "../stripe/init.php";
Cart::fromArray(json_decode($_REQUEST['cart']));
loadStore($_REQUEST['path_to_store']);
loadSecureSettings($_REQUEST['path_to_src']);
$r_subtotal = round(floatval($_REQUEST['subtotal']), 2);
$r_shipping = round(floatval($_REQUEST['shipping']), 2);
$r_total = round(floatval($_REQUEST['total']), 2);
$subtotal = round(Cart::subtotal(), 2);
$shipping = round(Cart::shippingCost(), 2);
$total = round(Cart::total(), 2);
R::attach("calculated_subtotal", $subtotal);
R::attach("calculated_shipping", $shipping);
R::attach("calculated_total", $total);
R::attach("requested_subtotal", $r_subtotal);
R::attach("requested_shipping", $r_shipping);
R::attach("requested_total", $r_total);
if ($r_subtotal == $subtotal && $r_shipping == $shipping && $r_total == $total) {
    R::attach("valid", true);
} else {
    R::attach("valid", false);
    R::error(10, "Cart totals not valid.");
    R::send();
}
$description = Cart::toString();
R::attach("description", $description);
\Stripe\Stripe::setApiKey($secure_settings->stripe);
$token = $_GET['stripeToken'];
Exemplo n.º 24
0
 public function postSearch($item = "")
 {
     if (Request::ajax()) {
         if (isset($_POST['buypid'])) {
             $optionprice = $name = DB::table('products_options')->where('product_id', $_POST['buypid'])->where("option_value", $_POST['buyoption'])->pluck('price');
             return $optionprice;
             exit;
         }
         if (isset($_POST['pid'])) {
             $item = Product::find($_POST['pid']);
             Cart::add(array('id' => $item->id, 'name' => $item->title, 'qty' => 1, 'price' => $item->price, 'options' => array('size' => Input::get("size"), 'buying' => Input::get('buying'), 'volume' => Input::get("volume"), 'optionid' => Input::get("optid"), 'weight' => Input::get("weight"))));
             $content = Cart::content();
             Session::put("cartItems", $content);
             $total = Cart::total();
             $itemHtml = "";
             $itemHtml .= "<div class='beta-select'><i class='fa fa-shopping-cart'></i><span id='cart-count'> Cart (" . Cart::count() . ")</span> <i class='fa fa-chevron-down'></i></div>\n                     <div class='beta-dropdown cart-body'>";
             if ($content) {
                 foreach ($content as $itemRow) {
                     $product = Product::find($itemRow->id);
                     if ($itemRow->options->has('buying') && $itemRow->options->buying != "") {
                         $itemRow->price = DB::table('products_options')->where("product_option_value_id", $itemRow->optionid)->pluck('price');
                     }
                     if (public_path()) {
                         $source_folder = public_path() . '/uploads/images/';
                         $destination_folder = public_path() . '/uploads/images/';
                     } else {
                         $source_folder = '/home/medicalng/public_html/uploads/images/';
                         $destination_folder = '/home/medicalng/public_html/uploads/images/';
                     }
                     $image_info = pathinfo($source_folder . $product->image);
                     $image_extension = strtolower($image_info["extension"]);
                     //image extension
                     $image_name_only = strtolower($image_info["filename"]);
                     //file name only, no extension
                     $imgName = $image_name_only . "-50x50" . "." . $image_extension;
                     $itemHtml .= "<div class='cart-item'>\n                             <!--<a class='cart-item-edit' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-pencil'></i></a>-->\n                             <a class='cart-item-delete' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-times'></i></a>\n                             <div class='media'>\n                                 <a class='pull-left' href=\"javascript:void(0);\"><img src='" . url() . "/uploads/images/thumbs/{$imgName}' alt=''></a>\n                                 <div class='media-body'>\n                                     <span class='cart-item-title'>" . $itemRow->name . "</span>\n                                     ";
                     $itemHtml .= "<span class='cart-item-options'>";
                     $itemHtml .= $itemRow->options->has('size') ? " - Size: " . $itemRow->options->size : '';
                     $itemHtml .= $itemRow->options->has('buying') ? " - Buying Option: " . $itemRow->options->buying : '';
                     $itemHtml .= $itemRow->options->has('volume') ? " - Volume: " . $itemRow->options->volume : '';
                     $itemHtml .= "</span>";
                     $itemHtml .= "\n                                     <span class='cart-item-amount'>{$itemRow->qty}*<span>&#8358;" . number_format($itemRow->price, 2, '.', ',') . "</span>\n                                 </div>\n                             </div>\n                         </div>\n\n                         ";
                 }
                 $itemHtml .= "<div class='cart-caption'>\n                             <div class='cart-total text-right'>Subtotal: <span class='cart-total-value'>&#8358;" . number_format($total, 2, ".", ",") . "</span></div>\n                             <div class='clearfix'></div>\n\n                             <div class='center'>\n                                 <div class='space10'>&nbsp;</div>\n                                 <a href='" . url() . "/cart' class='beta-btn primary text-center'>Checkout <i class='fa fa-chevron-right'></i></a>\n                             </div>\n                             </div>";
             } else {
                 $itemHtml .= "Cart is empty";
             }
             $itemHtml .= "</div>";
             echo $itemHtml;
         }
         if (isset($_POST['delid'])) {
             //$item = Product::find($_POST['delid']);
             Cart::remove($_POST['delid']);
             //(array('id' => $item->id, 'name' => $item->title, 'qty' => 1, 'price' => $item->price));
             $content = Cart::content();
             Session::put("cartItems", $content);
             $total = Cart::total();
             $itemHtml = "";
             $itemHtml .= "<div class='beta-select'><i class='fa fa-shopping-cart'></i><span id='cart-count'> Cart (" . Cart::count() . ")</span> <i class='fa fa-chevron-down'></i></div>\n                     <div class='beta-dropdown cart-body'>";
             if ($content) {
                 foreach ($content as $itemRow) {
                     $product = Product::find($itemRow->id);
                     if ($itemRow->options->has('buying') && $itemRow->options->buying != "") {
                         $itemRow->price = DB::table('products_options')->where("product_option_value_id", $itemRow->optionid)->pluck('price');
                     }
                     $image_info = pathinfo($source_folder . $product->image);
                     $image_extension = strtolower($image_info["extension"]);
                     //image extension
                     $image_name_only = strtolower($image_info["filename"]);
                     //file name only, no extension
                     $imgName = $image_name_only . "-50x50" . "." . $image_extension;
                     $itemHtml .= "<div class='cart-item'>\n                             <!--<a class='cart-item-edit' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-pencil'></i></a>-->\n                             <a class='cart-item-delete' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-times'></i></a>\n                             <div class='media'>\n                                 <a class='pull-left' href=\"javascript:void(0);\"><img src='" . url() . "/uploads/images/thumbs/{$imgName}' alt=''></a>\n                                 <div class='media-body'>\n                                     <span class='cart-item-title'>" . $itemRow->name . "</span>\n                                     ";
                     $itemHtml .= "<span class='cart-item-options'>";
                     $itemHtml .= $itemRow->options->has('size') ? " - Size: " . $itemRow->options->size : '';
                     $itemHtml .= $itemRow->options->has('buying') ? " - Buying Option: " . $itemRow->options->buying : '';
                     $itemHtml .= $itemRow->options->has('volume') ? " - Volume: " . $itemRow->options->volume : '';
                     $itemHtml .= "</span>";
                     $itemHtml .= "\n                                     <span class='cart-item-amount'>{$itemRow->qty}*<span>&#8358;" . number_format($itemRow->price, 2, '.', ',') . "</span>\n                                 </div>\n                             </div>\n                         </div>\n\n                         ";
                 }
                 $itemHtml .= "<div class='cart-caption'>\n                             <div class='cart-total text-right'>Subtotal: <span class='cart-total-value'>&#8358;" . number_format($total, 2, ".", ",") . "</span></div>\n                             <div class='clearfix'></div>\n\n                             <div class='center'>\n                                 <div class='space10'>&nbsp;</div>\n                                 <a href='" . url() . "/cart' class='beta-btn primary text-center'>Checkout <i class='fa fa-chevron-right'></i></a>\n                             </div></div>";
             } else {
                 $itemHtml .= "Cart is empty";
             }
             $itemHtml .= "</div>";
             echo $itemHtml;
         }
     }
 }
Exemplo n.º 25
0
|
*/
Route::get('/', function () {
    return view('site.index');
});
Route::group(['namespace' => 'Api'], function () {
    Route::group(['prefix' => 'api'], function () {
        Route::controller("product/{h?}", "ProductController");
    });
});
Route::get('/casex', function () {
    return dd(\Cart::all());
});
Route::get('/case0', function () {
    \Cart::add(['id' => 1231, 'name' => 'Zapatillas', 'quantity' => 1, 'price' => 100, 'tax' => '10%']);
});
Route::get('/case1', function () {
    \Cart::addCoupon(['id' => "ABC123", 'name' => "10% en Zapatillas", 'code' => "ABC123", 'discount' => "-20%"]);
    return "se ha agregado un cupon al carro";
});
Route::get('/case2', function () {
    \Cart::clear();
    return "se ha borrado la sesion";
});
Route::get('/case3', function () {
    \Cart::addOtherCharge(['id' => 12213, 'name' => 'shipping', 'amount' => 100]);
    return "se ha agregado el cargo";
});
Route::get('/case4', function () {
    return dd(\Cart::total(true));
});
Exemplo n.º 26
0
 public function testCartCanGetTotal()
 {
     Cart::add(1, 'test', 1, 10.0, array('size' => 'L'));
     Cart::add(2, 'test', 1, 10.0, array('size' => 'L'));
     $total = Cart::total();
     $this->assertTrue(is_float($total));
     $this->assertEquals($total, 20.0);
 }