ok
Direktori : /home2/selectio/public_html/ramali.in/ |
Current File : /home2/selectio/public_html/ramali.in/assets-header-js.php |
<script> function cart_count(){ console.log('count is working'); $.ajax({ url: 'ui-api/api-cart.php', type: 'post', data:{type:'c_count'}, dataType: 'json', success: function (response) { /*console.log(response);*/ if(response['status']==200){ $('.cart-count').text(response['cart_count']); }else{ $('.cart-count').text(response['cart_count']); } } }); } function login_popup(){ $(".login_btn").click(); } function aleady_added(){ alert("Already added"); } $(document).ready(function(){ cart_count(); }); function Quick_AddToCart(pro_id, variant_id){ <?php if(isset($_SESSION['ramali_textiles'])){ ?> console.log('quick cart'+variant_id); var variant = $('#product_variant_id').val(); console.log('products variats id is' +variant_id); $.ajax({ url: 'api/cart.php', type: 'post', data:{product_id:pro_id,type:'add_to_cart',variant_id:variant_id,product_variant_id:variant}, dataType: 'json', success: function (response) { console.log(response); if(response['status']==200){ $('#items_'+pro_id).empty(); $('.add_to_card').empty(); //$('#items_'+pro_id).append('<span class="btn btn-info btn-sm" style="background: green;"><i class="fi-rs-shopping-cart mr-5" style="color: white;"></i>Added</span>'); $('#newadded_'+pro_id).append(' <span onClick="aleady_added()" style="color: green;">Added</span>'); $('.add_to_card').append('<button onClick="aleady_added()" class="btn btn-warning btn-rounded">Added</button>'); $('#cart_items_count').text(response['cart_count']); alert(response['message']); //alert(response['message']); //$('#addon_loader').hide(); cart_count(); }else{ alert(response['message']); //alert(response['message']); //$('#addon_loader').hide(); } } }); <?php }else{ echo "login_popup();"; echo "alert('please Login...');"; }?> } </script> <!--<script> function Quick_AddToCart(pro_id, variant_id){ <?php //if(isset($_SESSION['ramali_textiles'])){ ?> console.log('quick cart'); $.ajax({ url: 'api/cart.php', type: 'post', data:{product_id:pro_id,type:'add_to_cart',product_variant_id:variant_id}, dataType: 'json', success: function (response) { console.log(response); if(response['status']==200){ $('#items_'+pro_id).empty(); $('#items_'+pro_id).append(' <span class="btn-cart btn-product btn btn-icon-right btn-link btn-underline" style="color: green;">Added</span>') $('#cart_items_count').text(response['cart_count']); alert(response['message']); cart_count(); }else{ alert(response['message']); cart_count(); } } }); <?php //}else{ //echo "alert('please Login...')"; //} ?> }//function </script>-->