خرید بک لینک

Vote count: 0

         var sum = 0;

    $(".cart-count").data('count', 0);
    $(document).ready(function () {

        $(".add_to_cart_button").click(function () {

            var id = $(this).data("id");
            $('#' + id).prop("disabled", "disable");
            var vender = $(this).data("vender");
            var price = $(this).data("price");
            var service = $(this).data("service");
            sum = sum + parseInt(price);

            var div = $('<div />',
            {

                id: 'kart_' + id,
                class: 'kartcontainer',
                text: service + "  :  " + price,


            });




             var buttun = $('<input />',
           {
               type: 'button',

               'data-price': +price,
               'data-vend': vender,
               'data-ser': service,
               class: 'removeFromKart',
               value: 'X',

               on: {
                   click: function () {

                       sum = sum - parseInt(price);
                       $('#' + id).removeAttr("disabled");

                       $(this).closest("div").remove();
                       $("#total").html('Total:' + sum);

                   }
               }
           });
           div.append(buttun).appendTo($("#cart"));
            $("#total").html('Total:' + sum);

});

In this code the items add in add to cart just for one main service and total also for that main service only....but i want to add for another main service total and item count also ... When i select another main service then total of that items again starts from that current service....how i manage for all services add in add to cart??

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 27 خرداد 1395 ساعت: 14:09

صفحه بندی