Код: Выделить всё
1 year
Add to cartNot Approved
< /code>
Вывод вышеуказанного кода - < /p>
Alex | 1 Year | 500 | Add to cart
blex | 1 Year | 300 | Add to cart
clex | 1 Year | 200 | Add to cart
Добавить в корзину
Код: Выделить всё
$(document).ready(function(){
$('.add_cart').click(function(){
var product_name = $(this).data("productname");
var product_id = $(this).data("productid");
var product_price = $(this).closest('tr').find('.calActivitylPrice').text();
var quantity =1 ;
var changeToRemoveBTNSec = $(this).closest('tr').find('.display_table');
$.ajax({
url:"Member_controller/addToCart",
method:"POST",
data:{product_id:product_id, product_name:product_name, product_price:product_price,quantity:quantity},
success:function(data)
{
var obj = JSON.parse(data);
$(changeToRemoveBTNSec).html('Remove');
$('#totalDetails').html(obj.cart_total);
$('#totalQty').html(obj.totalQty);
}
});
});
});
< /code>
После добавления продукта в корзину я получаю кнопку «Удалить», поэтому мой список < /p>
Alex | 1 Year | 500 | Add to cart
blex | 1 Year | 300 | remove
clex | 1 Year | 200 | remove
удалить из корзины
lement из cart
lement из cart
remove из cart
Код: Выделить всё
$(document).on('click', '.remove_inventory', function(){
var row_id = $(this).attr("id");
var changeToAddtocartBTN = $(this).closest('tr').find('.display_table');
if(confirm("Are you sure you want to remove this?"))
{
$.ajax({
url:"Member_controller/Removecart",
method:"POST",
data:{row_id:row_id},
success:function(data)
{
var obj = JSON.parse(data);
alert("Product removed from Cart");
$(changeToAddtocartBTN).html('
Подробнее здесь: [url]https://stackoverflow.com/questions/54205948/how-to-add-the-product-again-to-the-cart-or-add-to-cart-button-not-working[/url]
Мобильная версия