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


PHP Cart::get方法代码示例

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


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

示例1: testCartCanGet

 public function testCartCanGet()
 {
     Cart::add(1, 'test', 1, 10.0, array('size' => 'L'));
     $rowId = Cart::content()->first()->rowid;
     $row = Cart::get($rowId);
     $this->assertEquals($row->id, 1);
     $this->assertEquals($row->name, 'test');
     $this->assertEquals($row->qty, 1);
     $this->assertEquals($row->price, 10.0);
     $this->assertInstanceOf('Gloudemans\\Shoppingcart\\CartRowCollection', $row);
     $this->assertInstanceOf('Gloudemans\\Shoppingcart\\CartRowOptionsCollection', $row->options);
     $this->assertEquals($row, Cart::content()->first());
     $this->assertInstanceOf('Gloudemans\\Shoppingcart\\CartCollection', Cart::content());
 }
开发者ID:yashb,项目名称:generator,代码行数:14,代码来源:CartTest.php

示例2: minusCart

 public function minusCart($deal_id)
 {
     $cart = \Cart::get($deal_id);
     $newQuantity = --$cart->quantity;
     if ($newQuantity <= 0) {
         \Cart::remove($deal_id);
     } else {
         \Cart::update($deal_id, ['quantity' => $newQuantity]);
     }
     return redirect('/gio-hang');
 }
开发者ID:nhatkhoa,项目名称:GroupBuy,代码行数:11,代码来源:MainController.php

示例3: itemsSum

 public function itemsSum()
 {
     $cart = Cart::get($this->id);
     $sums = [];
     foreach ($cart->cartItems as $cartItem) {
         if (!$cartItem->price) {
             continue;
         }
         $sums[$cartItem->price->currency_id] = isset($sums[$cartItem->price->currency_id]) ? $sums[$cartItem->price->currency_id] + $cartItem->price->price * $cartItem->count : $cartItem->price->price * $cartItem->count;
     }
     return new \Money\Sums($sums);
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:12,代码来源:Cart.php

示例4: get

 /**
  * Get all cart items stored on the session
  * @return array
  */
 public function get()
 {
     return $this->session->get('cart');
 }
开发者ID:Gatix,项目名称:laravel-cart,代码行数:8,代码来源:SessionRepository.php

示例5: 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

示例6: 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


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