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


PHP Cart::getContent方法代码示例

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


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

示例1: postCheckout

 public function postCheckout(Request $request)
 {
     \DB::beginTransaction();
     $customer = Customer::create($request->all());
     $order = $customer->orders()->create(['quantity' => \Cart::getTotalQuantity(), 'total' => \Cart::getTotal(), 'shipped' => false]);
     foreach (\Cart::getContent() as $cart) {
         $order->details()->create(['deal_id' => $cart->id, 'quantity' => $cart->quantity, 'price' => $cart->price]);
     }
     $order->push();
     $customer->push();
     \DB::commit();
     \Cart::clear();
     return view('frontend.checkout.done')->with('categories', Category::all());
 }
开发者ID:nhatkhoa,项目名称:GroupBuy,代码行数:14,代码来源:MainController.php

示例2: url

ID
名称
价格
数量
<br>

<?php 
$rs = Cart::getContent();
foreach ($rs as $item) {
    ?>
   {{ $item->id }} 
    {{ $item->name }}  
   {{ $item->price }} 
   {{ $item->quantity }}
   {{ $item->attributes }}
   <br>
<?php 
}
?>

<a href="{{ url('cart/checkout') }}">确认购买</a>
开发者ID:cdandy,项目名称:artup,代码行数:21,代码来源:index.blade.php

示例3: function

    if (Request::ajax()) {
        $product_id = Request::get('id');
        //Cart::remove($product_id);
        //Cart::clear();
        $cartData = Cart::getContent();
        return $cartData->toArray();
    } else {
        return "not ajax";
    }
});
Route::post('/product/deletecart', function () {
    if (Request::ajax()) {
        $product_id = Request::get('id');
        Cart::remove($product_id);
        //Cart::clear();
        $cartData = Cart::getContent();
        return $cartData->toJson();
    } else {
        return "not ajax";
    }
});
Route::post('product/add_to_cart', function () {
    if (Request::ajax()) {
        $i = 0;
        $data = Input::all();
        //return $data[];
        //dd($fonts);
        foreach ($data['dataArr'] as $val) {
            echo $val['color'];
        }
        //$ar = explode(':', $datam[0]);
开发者ID:hasanmahamud31,项目名称:project-ecommerce,代码行数:31,代码来源:routes.php

示例4:

@extends('layout.main')
@section('content')
	@if(Cart::getTotalQuantity() == 0)
		<div class="register_account">
           <div class="wrap">
    	     <h4 class="title">Shopping cart is empty</h4>
    	     <p class="cart">You have no items in your shopping cart.<br>Click<a href="/home"> here</a> to continue shopping</p>
    	   </div>
    	</div>

	@else
		<?php 
$items = Cart::getContent();
?>
		<div class = "container-fluid">
		@foreach($items as $item)
		<?php 
$item = App\products::find($item->id);
?>
			<div class = "col-md-4" style = "max-height:172px;margin-bottom:100px;">
					
					<div class="inner_content clearfix">
					<div class="product_image">
						<img style = "max-height:152px" src="{{App\configStrategy::getGomecoInventoryWebsite()}}{{$item->picture}}" alt=""/>
					</div>
					
					 <div class="price">
					   <div class="cart-left">
							<p class="title">{{$item->productName}}</p>
							<div class="price1"> <span class="actual">₱ {{$item->sellingprice}}</span> </div>
					  		<a href="product/{{$item->id}}">view details</a>
开发者ID:abrenicamarkjoshua,项目名称:gomeco,代码行数:31,代码来源:mycart.blade.php


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