added update card count
This commit is contained in:
parent
c4d08a268b
commit
561834d109
|
|
@ -4,6 +4,7 @@
|
|||
<div class="icon-wrapper">
|
||||
<img src="{{ bagisto_asset('icons/icon (cart).svg') }}" alt="cart" />
|
||||
</div>
|
||||
<span>{{__('shop::app.checkout.cart.title')}} @if($cart)({{ $cart->items->count() }})@endif</span>
|
||||
<span>{{__('shop::app.checkout.cart.title')}} <span class="count-cart-item">@if($cart)({{ $cart->items->count() }})@endif<span></span>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -370,6 +370,9 @@
|
|||
function showPopup(data = null) {
|
||||
if (data === null) return;
|
||||
|
||||
document.querySelector('.count-cart-item').textContent = '('+data.count_cart_item+')';
|
||||
document.querySelector('.cart-quantity').textContent = data.count_cart_item;
|
||||
|
||||
// Update the popup content with the product data
|
||||
document.querySelector('.add-product-item-header h4').textContent = data.name;
|
||||
document.querySelector('.add-product-item-price').textContent = data.price;
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@
|
|||
<a href="{{ route('shop.checkout.cart.index') }}" class="nav-link">
|
||||
<div class="icon-wrapper">
|
||||
<img src="{{ bagisto_asset('icons/cart.svg') }}" alt="cart" />
|
||||
@if(isset($cart))<span class="cart-quantity">{{ $cart->items->count() }}</span>@endif
|
||||
<span class="cart-quantity">@if(isset($cart)){{ $cart->items->count() }}@endif</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Webkul\Customer\Repositories\WishlistRepository;
|
|||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
|
||||
use Webkul\Product\Facades\ProductImage;
|
||||
// use Webkul\Checkout\Facades\Cart as WebkulCart;
|
||||
|
||||
class CartController extends Controller
|
||||
{
|
||||
|
|
@ -132,12 +133,15 @@ class CartController extends Controller
|
|||
$productImage = ProductImage::getProductBaseImage($product)['medium_image_url'];
|
||||
$priceHTML = core()->currency($product->price);
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Product added to cart successfully',
|
||||
'product' => [
|
||||
'name' => $product->name,
|
||||
'image' => $productImage,
|
||||
'price' => $priceHTML,
|
||||
'count_cart_item' => $cart->items->count(),
|
||||
]
|
||||
], 200);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue