add cart test
This commit is contained in:
parent
2acbdf023c
commit
a728c7d703
|
|
@ -111,4 +111,25 @@ class Session extends ComponentBase
|
|||
return $dataqq;
|
||||
}
|
||||
|
||||
|
||||
function onDeleteCartItemPage()
|
||||
{
|
||||
$getToken = SessionP::get('nurgulToken');
|
||||
$dataInput = post();
|
||||
|
||||
$response = Http::delete('http://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) {
|
||||
$http->header('Authorization', 'Bearer '.$getToken);
|
||||
});
|
||||
|
||||
$dataqq = json_decode($response);
|
||||
|
||||
if (!empty($dataqq)) {
|
||||
Flash::success("Üstünlikli Sebede Goşuldy");
|
||||
return redirect()->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
title = "Cart"
|
||||
url = "/cart"
|
||||
layout = "mainN"
|
||||
==
|
||||
{%partial "bread" title='cart.title'|_ %}
|
||||
|
||||
<!-- SHOPING CART AREA START -->
|
||||
<div class="liton__shoping-cart-area mb-100">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="shoping-cart-inner">
|
||||
<div class="shoping-cart-table table-responsive">
|
||||
<table class="table">
|
||||
<!-- <thead>
|
||||
<th class="cart-product-remove">Remove</th>
|
||||
<th class="cart-product-image">Image</th>
|
||||
<th class="cart-product-info">Product</th>
|
||||
<th class="cart-product-price">Price</th>
|
||||
<th class="cart-product-quantity">Quantity</th>
|
||||
<th class="cart-product-subtotal">Subtotal</th>
|
||||
</thead> -->
|
||||
<tbody id="cart_page_inside">
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<tr class="cart-coupon-row">
|
||||
<td colspan="6">
|
||||
<div class="cart-coupon">
|
||||
<input type="text" name="cart-coupon" placeholder="Coupon code">
|
||||
<button type="submit" class="btn theme-btn-2 btn-effect-2">Apply
|
||||
Coupon</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<button type="submit"
|
||||
class="btn theme-btn-2 btn-effect-2-- disabled">Update Cart</button>
|
||||
</td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="shoping-cart-total mt-50">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>{{'cart.total'|_}}</strong></td>
|
||||
<td><strong id="cart_page_total">0.00 TMT</strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="btn-wrapper text-right">
|
||||
<a href="/" class="theme-btn-1 btn btn-effect-1">{{'cart.checkout.title'|_}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- SHOPING CART AREA END -->
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<h5>{{'cart.total'|_}} <span id="cart_total_aside">0.00 TMT</span></h5>
|
||||
</div>
|
||||
<div class="btn-wrapper">
|
||||
<a href="/" class="theme-btn-1 btn btn-effect-1">{{'cart.view.title'|_}}</a>
|
||||
<a href="/cart" class="theme-btn-1 btn btn-effect-1">{{'cart.view.title'|_}}</a>
|
||||
<a href="/" class="theme-btn-2 btn btn-effect-2">{{'cart.checkout.title'|_}}</a>
|
||||
</div>
|
||||
<!-- <p>Free Shipping on All Orders Over $100!</p> -->
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@
|
|||
<!-- header-bottom-area end -->
|
||||
</header>
|
||||
<!-- HEADER AREA END -->
|
||||
|
||||
{% if nurgulToken != "" %}
|
||||
{% put scripts %}
|
||||
<script>
|
||||
|
|
@ -162,12 +163,15 @@
|
|||
$('#emptyC').hide();
|
||||
|
||||
var cart = data.data;
|
||||
console.log(data);
|
||||
console.log(cart.vendors["nurgulShop"]);
|
||||
|
||||
$('#cart_qty').html(cart.items_count);
|
||||
$('#cart_total').html(cart.formatted_grand_total);
|
||||
$('#cart_total_aside').html(cart.formatted_grand_total);
|
||||
|
||||
$('#cart_page_total').html(cart.formatted_grand_total);
|
||||
|
||||
for (var cart of cart.vendors["nurgulShop"]) {
|
||||
// console.log(product.hasOwnProperty('special_price'));
|
||||
$('#cart_inside').append(
|
||||
|
|
@ -181,6 +185,25 @@
|
|||
<span class="mini-cart-quantity">`+ cart.additional.quantity + ` x ` + cart.formatted_price + `</span>
|
||||
</div>
|
||||
</div>`);
|
||||
|
||||
$('#cart_page_inside').append(
|
||||
`<tr>
|
||||
<td class="cart-product-remove"><a href="javascript:;" data-request="onDeleteCartItemPage" data-request-data="item_id: `+ cart.id +`"><div>x</div></a></td>
|
||||
<td class="cart-product-image">
|
||||
<a href="/product/detail/` + cart.additional.product_id + `"><img src="` + cart.product.images[0].small_image_url + `" alt="#"></a>
|
||||
</td>
|
||||
<td class="cart-product-info">
|
||||
<h4><a href="/product/detail/` + cart.additional.product_id + `">` + cart.product.name + `</a></h4>
|
||||
</td>
|
||||
<td class="cart-product-price">` + cart.formatted_price + `</td>
|
||||
<td class="cart-product-quantity">
|
||||
<div class="cart-plus-minus">
|
||||
<input type="text" value="`+ cart.additional.quantity + `" name="qtybutton"
|
||||
class="cart-plus-minus-box">
|
||||
</div>
|
||||
</td>
|
||||
<td class="cart-product-subtotal">` + cart.formatted_total + `</td>
|
||||
</tr>`);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue