当前位置: 首页>>代码示例>>PHP>>正文


PHP Cart::total方法代码示例

本文整理汇总了PHP中Cart::total方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::total方法的具体用法?PHP Cart::total怎么用?PHP Cart::total使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cart的用法示例。


在下文中一共展示了Cart::total方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postDelete

 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));
     }
 }
开发者ID:Rotron,项目名称:shop,代码行数:11,代码来源:CartController.php

示例2: make

 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;
 }
开发者ID:abada,项目名称:webshop,代码行数:11,代码来源:OrderWorker.php

示例3: process

 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');
 }
开发者ID:Rubenazo,项目名称:belleza,代码行数:37,代码来源:ShoppingController.php

示例4: store

 /**
  * 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');
 }
开发者ID:elioth010,项目名称:carretilla_online,代码行数:29,代码来源:OrderController.php

示例5:

                      </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
开发者ID:rereyossi,项目名称:hairstuation,代码行数:30,代码来源:create.blade.php

示例6: testTotal

 /**
  * @dataProvider containsData
  */
 public function testTotal($products, $total)
 {
     $cart = new \Cart();
     $cart->add($products);
     $this->assertEquals($cart->total(), $total);
 }
开发者ID:Husband,项目名称:test-assigments,代码行数:9,代码来源:CartTest.php

示例7: receipt

 /**
 * 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);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:15,代码来源:PaymentController.php

示例8: totalCart

 public function totalCart()
 {
     return \Cart::total();
 }
开发者ID:abada,项目名称:webshop,代码行数:4,代码来源:CartWorker.php

示例9: updateQuantity

 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');
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:35,代码来源:OrderController.php

示例10: PaymentCreateTeam

 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@leaguetogether.com', '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);
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:86,代码来源:ClubPublicController.php

示例11: price

</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>
开发者ID:devhook,项目名称:shop,代码行数:31,代码来源:cart.php

示例12: postPaymentsuccess

 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('care@Funfest.com', '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 = "techwarrior@Funfest.com";
         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('care@Funfest.com', 'Funfest');
                 $message->subject('RE: Order successful, Funfest order no. ' . $order_info['txnid']);
                 $message->to($vendor_email);
                 //->cc('care@Funfest.com');
             });
         } else {
             Mail::send('emails.vendornotify', array('details_for_order' => $order_info, 'products' => $products, 'total' => $total), function ($message) use($billing_det) {
                 $message->from('care@Funfest.com', 'Funfest');
                 $message->subject('RE: Order for cake (vendor email was null).');
                 $message->to('care@Funfest.com');
             });
         }
         // Send messgae to user
         $username = "thevikin";
         $password = "185473";
         $url = "http://smslane.com/vendorsms/pushsms.aspx?user=" . $username . "&password=" . $password . "&msisdn=91" . $order_info['phone'] . "&sid=WebSms&msg=Your order has been placed successfully. Your order id is " . $order_info['txnid'] . "&fl=1";
//.........这里部分代码省略.........
开发者ID:abaecor,项目名称:funfest,代码行数:101,代码来源:HomeController.php

示例13: testCalculPriceWithFirstAndSecondCoupon

 /**
  * @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);
 }
开发者ID:abada,项目名称:webshop,代码行数:22,代码来源:CartWorkerTest.php

示例14: checkout

 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'));
 }
开发者ID:shittyc0de,项目名称:AplikasiLC,代码行数:9,代码来源:StoreController.php

示例15: getRefresh

 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));
     }
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:19,代码来源:ItemController.php


注:本文中的Cart::total方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。