fixed cart
This commit is contained in:
parent
f9d86bdaf5
commit
ed40c22072
|
|
@ -18,10 +18,12 @@ class CartList extends JsonResource
|
|||
{
|
||||
$sku = $this->sku;
|
||||
$price = $sku->price;
|
||||
$description = $sku->product->description;
|
||||
$subTotal = $price * $this->quantity;
|
||||
return [
|
||||
'product_id' => $this->product_id,
|
||||
'sku_id' => $this->product_sku_id,
|
||||
'name' => $description->name,
|
||||
'image' => image_resize($sku->image),
|
||||
'price' => $price,
|
||||
'price_format' => currency_format($price),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ class CartService
|
|||
if (empty($customer)) {
|
||||
return [];
|
||||
}
|
||||
$cartItems = Cart::query()->where('customer_id', $customer->id)->get();
|
||||
$cartItems = Cart::query()
|
||||
->with(['sku.product.description'])
|
||||
->where('customer_id', $customer->id)
|
||||
->get();
|
||||
$cartList = CartList::collection($cartItems)->jsonSerialize();
|
||||
return $cartList;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue