本文整理汇总了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());
}
示例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>
示例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]);
示例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>