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


PHP Cart::contents方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /carts/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     foreach (Cart::contents() as $item) {
         if ($item->id == $id) {
             $item->remove();
         }
     }
     return 'true';
 }
开发者ID:VerticalHorizon,项目名称:Bumagi,代码行数:16,代码来源:CartController.php

示例2: checkout

 public function checkout(\App\Http\Requests\OrderFormRequest $request)
 {
     $data = \Request::all();
     $data["items"] = \Cart::contents();
     \Mail::send('orderemail', $data, function ($m) {
         $m->from('hello@app.com', 'Your Application');
         $m->to("mirompm@gmail.com", "Admin")->subject('Your Reminder!');
     });
     Cart::destroy();
     return redirect("cart");
 }
开发者ID:skull213,项目名称:kiwigrown,代码行数:11,代码来源:CartController.php

示例3: checkout

 function checkout()
 {
     // process cart items
     if (count(Cart::contents()) < 1) {
         return Redirect::to('order');
     }
     $items = Cart::contents();
     $invoice_id = DB::table('invoices')->insertGetId(array('user_id' => Auth::user()->id, 'due_date' => date('Y-m-d'), 'status' => 'Unpaid'));
     foreach ($items as $item) {
         // to ensure the shopping cart was not manipulated, we use the option directly, not from the price
         $option = ServiceOption::find($item->id);
         // build description string
         $description = $option->service->name . ' ' . $option->name . ' recurring every ' . $item->quantity . ' month(s)';
         DB::table('invoice_items')->insert(array('invoice_id' => $invoice_id, 'description' => $description, 'unit_price' => $item->price));
     }
     // push invoice to e-mail queue
     // empty the cart
     Cart::destroy();
     return Redirect::to('order/thankyou');
 }
开发者ID:carriercomm,项目名称:saaspanel,代码行数:20,代码来源:OrderController.php

示例4: __construct

 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 public function __construct()
 {
     $this->beforeFilter(function () {
         // if((isset($_GET['access_id']) && $_GET['access_id'] == '5437edf7890') || isset($_COOKIE['access_id'])){
         // 	if(!isset($_COOKIE['access_id'])){
         // 		setcookie('access_id', $_GET['access_id'], time() + (3600));
         // 	}
         View::share('catnav', Category::all());
         View::share('cart_values', Cart::contents());
         if (Auth::check()) {
             View::share('super', 0);
             View::share('vendor', 0);
             View::share('user', 0);
             View::share('user_id', Auth::user()->id);
             if (Auth::user()->isSuper) {
                 View::share('super', 1);
                 Session::put('user_status', 'super');
             } elseif (Auth::user()->isVendor) {
                 $notification = Order::where('vendor_id', '=', Auth::user()->id)->where('notification', '=', 1)->count();
                 View::share('vendor', 1);
                 Session::put('notification', $notification);
                 Session::put('user_status', 'vendor');
             } else {
                 View::share('user', 1);
                 Session::put('user_status', 'user');
             }
             View::share('guest_user', 0);
         } else {
             View::share('guest_user', 1);
             $notification = 0;
             Session::put('notification', $notification);
             Session::put('user_status', 'guest_user');
             View::share('user_id', uniqid());
         }
         // }else{
         // 	 return Redirect::to('http://www.Funfest.com');
         // }
     });
 }
开发者ID:abaecor,项目名称:funfest,代码行数:44,代码来源:BaseController.php

示例5: getCart

 public function getCart()
 {
     return View::make('store.cart')->with('products', Cart::contents());
 }
开发者ID:y471n,项目名称:laravel-ecomm,代码行数:4,代码来源:StoreController.php

示例6: PaymentSuccess

 public function PaymentSuccess($id)
 {
     $result = Session::get('result');
     $user = Auth::user();
     $participant = Participant::find($id);
     $player = $participant->player;
     $club = $participant->event->club;
     $title = 'League Together - ' . $participant->event->club->name . ' Events';
     if (!$result) {
         return Redirect::action('AccountController@index');
     }
     $param = array('transaction_id' => $result->transactionid, 'club' => $club->id, 'action_type' => $result->type);
     $payment = new Payment();
     $transaction = json_decode(json_encode($payment->ask($param)), false);
     $items = Cart::contents();
     // Clean the cart
     Cart::destroy();
     return View::make('app.club.event.participant.checkout.success')->with('page_title', 'Payment Complete')->withUser($user)->with('products', $items)->with('result', $result)->with('transaction', $transaction->transaction);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:19,代码来源:ParticipantController.php

示例7: gobuy

 function gobuy()
 {
     self::is_login();
     $info = M('member')->where('id=' . $_SESSION['dami_uid'])->find();
     $this->assign('uinfo', $info);
     $iscart = $_REQUEST['iscart'];
     if ($iscart == 1) {
         import('ORG.Util.Cart');
         $cart = new Cart();
         $list = $cart->contents();
         foreach ($list as $k => $v) {
             if ($v['id']) {
                 $list[$k]['gtype'] = $v['option']['gtype'];
                 $list[$k]['pic'] = $v['option']['pic'];
             }
         }
     } else {
         $list = array(0 => $_REQUEST);
     }
     if (!$list) {
         $this->error('您的购物为空,请先选择物品!');
         exit;
     }
     $this->assign('list', $list);
     $this->display();
 }
开发者ID:babyhuangshiming,项目名称:webserver,代码行数:26,代码来源:MemberAction.class.php

示例8: error

 public function error($param, $id, $playerid)
 {
     setlocale(LC_MONETARY, "en_US");
     $club = Club::Find($id);
     $user = Auth::user();
     $player = Player::find($playerid);
     $query = array('report_type' => 'customer_vault', 'customer_vault_id' => $user->profile->customer_vault, 'club' => $club->id);
     $payment = new Payment();
     $vault = json_decode(json_encode($payment->ask($query)), false);
     //convert object to array
     $dt = json_decode(json_encode($param), false);
     //clean duplicates from array
     //$club = array_unique($club);
     //cart content
     $items = Cart::contents();
     $data = array('data' => $dt, 'vault' => $vault, 'products' => $items, 'club' => $club, 'player' => $player);
     $mail = Mail::send('emails.receipt.error', $data, function ($message) use($user, $club) {
         $message->to($user->email, $user->profile->firstname . ' ' . $user->profile->lastname)->subject("Payment Declined | {$club->name}");
         foreach ($club->users()->get() as $value) {
             $message->bcc($value->email, $club->name)->subject("Payment Declined - {$club->name}");
         }
     });
     return $mail;
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:24,代码来源:Payment.php

示例9: import

 function ajax_cart_list()
 {
     import('ORG.Util.Cart');
     $cart = new Cart();
     $this->ajaxReturn($cart->contents(), '成功', 1);
 }
开发者ID:babyhuangshiming,项目名称:webserver,代码行数:6,代码来源:PublicAction.class.php

示例10: selectplayer

 public function selectplayer()
 {
     $user = Auth::user();
     $cart = Cart::contents();
     // return $cart;
     return View::make('pages.public.select')->with('page_title', 'Select Player')->withPlayers($user->players)->with('products', $cart);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:7,代码来源:PaymentController.php

示例11: getCart

 public function getCart()
 {
     $vendor_id = '';
     if (count(Cart::contents()) != 0) {
         $det = Cart::contents();
         foreach ($det as $item) {
             $vendor_id = $item->vendor_id;
         }
     }
     $addon_items = '';
     if ($vendor_id != '') {
         $addon_items = Addon::where('vendor_id', '=', $vendor_id)->get();
     }
     return View::make('home.cart')->with('products', Cart::contents())->with('addon_items', $addon_items)->with('city_list', City::all());
 }
开发者ID:abaecor,项目名称:funfest,代码行数:15,代码来源:HomeController.php

示例12: getCountOfItems

 private function getCountOfItems($excludeSets = FALSE, $currentWorkshopYearOnly = FALSE)
 {
     $count = array('CD' => array('count' => 0, 'sub_total_amt' => 0.0), 'DVD' => array('count' => 0, 'sub_total_amt' => 0.0), 'MP3' => array('count' => 0, 'sub_total_amt' => 0.0), 'SET' => array('count' => 0, 'sub_total_amt' => 0.0));
     $currentWorkshopYear = Config::get('workshop.current_workshop_year');
     // Use shopping cart, if still populated...
     if (Cart::contents()) {
         $cartContents = Cart::contents();
         /*                foreach ( $cartContents as $cartItem ) {
                             if ( !$currentWorkshopYearOnly || 
                                     ( $currentWorkshopYear && $cartItem->workshop_year == $currentWorkshopYear ) ) {
                                 if ( $cartItem->prod_type == 'SET' && !$excludeSets ) {
                                     if ( substr($cartItem->form_id, 0, 1) == 'C' ) {
                                         $count['CD']['count'] += $cartItem->unit_count * $cartItem->quantity;
                                         $count['CD']['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
                                     } else {
                                         $count[substr($cartItem->form_id, 0, 3)]['count'] += $cartItem->unit_count * $cartItem->quantity;
                                         $count[substr($cartItem->form_id, 0, 3)]['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
                                     }
                                 } else {
                                     $count[$cartItem->prod_type]['count'] += $cartItem->unit_count * $cartItem->quantity;
                                     $count[$cartItem->prod_type]['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
                                 }
                             }
                         }
          * 
          */
         // ... Otherwise, use order items.
     } else {
         if ($this->order_id > 0) {
             $orderItems = Order::find($this->order_id)->orderItems;
             $cartContents = OrdersController::convertOrderItemsToCartItems($orderItems);
             /*                    foreach ( $orderItems as $orderItem ) {
                                     $product = $orderItem->product();
                                     if ( !$currentWorkshopYearOnly || 
                                         ( $currentWorkshopYear && $product->workshop_year == $currentWorkshopYear ) ) {
                                         if ( $product->prod_type == 'SET' && !$excludeSets ) {
                                             if ( substr($product->form_id, 0, 1) == 'C' ) {
                                                 $count['CD']['count'] += $product->unit_count * $orderItem->quantity;
                                                 $count['CD']['sub_total_amt'] += $product->price * $orderItem->quantity;
                                             } else {
                                                 $count[substr($product->form_id, 0, 3)]['count'] += $product->unit_count * $orderItem->quantity;
                                                 $count[substr($product->form_id, 0, 3)]['sub_total_amt'] += $product->price * $orderItem->quantity;
                                             }
                                         } else {
                                             $count[$product->prod_type]['count'] += $product->unit_count * $orderItem->quantity;
                                             $count[$product->prod_type]['sub_total_amt'] += $product->price * $orderItem->quantity;
                                         }
                                     }
                                 }
              * 
              */
         }
     }
     foreach ($cartContents as $cartItem) {
         if (!$currentWorkshopYearOnly || $currentWorkshopYear && $cartItem->workshop_year == $currentWorkshopYear) {
             if ($cartItem->prod_type == 'SET' && !$excludeSets) {
                 if (substr($cartItem->form_id, 0, 1) == 'C') {
                     $count['CD']['count'] += $cartItem->unit_count * $cartItem->quantity;
                     $count['CD']['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
                 } else {
                     $count[substr($cartItem->form_id, 0, 3)]['count'] += $cartItem->unit_count * $cartItem->quantity;
                     $count[substr($cartItem->form_id, 0, 3)]['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
                 }
             } else {
                 $count[$cartItem->prod_type]['count'] += $cartItem->unit_count * $cartItem->quantity;
                 $count[$cartItem->prod_type]['sub_total_amt'] += $cartItem->price * $cartItem->quantity;
             }
         }
     }
     return $count;
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:71,代码来源:OrdersController.php

示例13: PaymentSuccessTeam

 public function PaymentSuccessTeam($club, $id)
 {
     $result = Session::get('result');
     $user = Auth::user();
     $team = Team::find($id);
     $club = Club::find($club);
     $title = 'League Together - ' . $club->name . ' Teams';
     if (!$result) {
         return Redirect::action('AccountController@index');
     }
     /*
     		$param = array(
     			'report_type'				=> 'customer_vault',
     			'customer_vault_id'	=> $user->profile->customer_vault,
     			'club' 							=> $club->id
     			);
     		$payment = new Payment;
     		$vault = $payment->ask($param);*/
     //get transaction data from CF
     $param = array('transaction_id' => $result->transactionid, 'club' => $club->id, 'action_type' => $result->type);
     $payment = new Payment();
     $transaction = json_decode(json_encode($payment->ask($param)), false);
     $items = Cart::contents();
     // Clean the cart
     Cart::destroy();
     return View::make('app.public.club.team.success')->with('page_title', 'Payment Complete')->withUser($user)->with('products', $items)->with('result', $result)->with('transaction', $transaction->transaction);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:27,代码来源:ClubPublicController.php

示例14: showCart

 public function showCart()
 {
     $cartContents = Cart::contents();
     $this->layout->contents = View::make('products.show-cart', compact('cartContents'))->with(array('orderVerification' => FALSE));
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:5,代码来源:ProductsController.php


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