Search the Community
Showing results for tags 'cart-summary.js'.
-
Hey everyone, I see everywhere that cart-summary.js should be here and there but it's never the place where mine is. I've look for it for hours, where should it be in 1.7.7.3 version please ?
- 1 reply
-
- cart-summary.js
- file
-
(and 5 more)
Tagged with:
-
Hi everyone: I am using prestashop 1.6.1.1 and basicly I have two types of products: The first group are fabrics that are sold in increments of 10 cm with a minimum quantity of 30cm. The second group are the rest of products that are sold 1 by 1 with a minimum quantity of 1. When I am doing the queckout, the "shopping-cart-product-line.tpl" file runs "themes/default/js/cart-summary.js" javascript file. This file defines the number of units to up or down the total quantity of the product. My problem is: if the total quantity of the product is >=30 units I want to increase the total quantity in 10 units (because the product is a fabric). If the total quantity of the product is < 30 units I want to increase the total quantity in 1 unit (because the product isn´t a fabric). In order to do this, I studied the code of the "cart-summary.js" file but I don´t find the way to do it because I don´t find the variable that contains the total quantity of the product. Any idea how i could get it? Thanks in advance. function upQuantity(id, qty) { if (typeof(qty) == 'undefined' || !qty) qty = 1; var customizationId = 0; var productId = 0; var productAttributeId = 0; var id_address_delivery = 0; var ids = 0; ids = id.split('_'); productId = parseInt(ids[0]); if (typeof(ids[1]) !== 'undefined') productAttributeId = parseInt(ids[1]); if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') customizationId = parseInt(ids[2]); if (typeof(ids[3]) !== 'undefined') id_address_delivery = parseInt(ids[3]); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', data: 'controller=cart' + '&ajax=true' + '&add=true' + '&getproductprice=true' + '&summary=true' + '&id_product=' + productId + '&ipa=' + productAttributeId + '&id_address_delivery=' + id_address_delivery + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') + '&qty=' + qty + '&token=' + static_token + '&allow_refresh=1', success: function(jsonData) { if (jsonData.hasError) { var errors = ''; for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') errors += $('<div />').html(jsonData.errors[error]).text() + "\n"; if (!!$.prototype.fancybox) $.fancybox.open([ { type: 'inline', autoScale: true, minHeight: 30, content: '<p class="fancybox-error">' + errors + '</p>' }], { padding: 0 }); else alert(errors); $('input[name=quantity_'+ id +]').val($('input[name=quantity_'+ id +'_hidden]').val()); } else { if (jsonData.refresh) location.reload(); updateCartSummary(jsonData.summary); if (window.ajaxCart != undefined) ajaxCart.updateCart(jsonData); if (customizationId !== 0) updateCustomizedDatas(jsonData.customizedDatas); updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); if (typeof(getCarrierListAndUpdate) !== 'undefined') getCarrierListAndUpdate(); if (typeof(updatePaymentMethodsDisplay) !== 'undefined') updatePaymentMethodsDisplay(); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { if (textStatus !== 'abort') { error = "TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus; if (!!$.prototype.fancybox) $.fancybox.open([ { type: 'inline', autoScale: true, minHeight: 30, content: '<p class="fancybox-error">' + error + '</p>' }], { padding: 0 }); else alert(error); } } }); }
-
Hi everyone: I am using prestashop 1.6.1.1 and basicly I have two types of products: The first group are fabrics that are sold in increments of 10 cm with a minimum quantity of 30cm. The second group are the rest of products that are sold 1 by 1 with a minimum quantity of 1. When I am doing the queckout, the "shopping-cart-product-line.tpl" file runs "themes/default/js/cart-summary.js" javascript file. This file defines the number of units to up or down the total quantity of the product. My problem is: if the total quantity of the product is >=30 units I want to increase the total quantity in 10 units (because the product is a fabric). If the total quantity of the product is < 30 units I want to increase the total quantity in 1 unit (because the product isn´t a fabric). In order to do this, I studied the code of the "cart-summary.js" file but I don´t find the way to do it because I don´t find the variable that contains the total quantity of the product. Any idea how i could get it? Thanks in advance. function upQuantity(id, qty) { if (typeof(qty) == 'undefined' || !qty) qty = 1; var customizationId = 0; var productId = 0; var productAttributeId = 0; var id_address_delivery = 0; var ids = 0; ids = id.split('_'); productId = parseInt(ids[0]); if (typeof(ids[1]) !== 'undefined') productAttributeId = parseInt(ids[1]); if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') customizationId = parseInt(ids[2]); if (typeof(ids[3]) !== 'undefined') id_address_delivery = parseInt(ids[3]); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', data: 'controller=cart' + '&ajax=true' + '&add=true' + '&getproductprice=true' + '&summary=true' + '&id_product=' + productId + '&ipa=' + productAttributeId + '&id_address_delivery=' + id_address_delivery + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') + '&qty=' + qty + '&token=' + static_token + '&allow_refresh=1', success: function(jsonData) { if (jsonData.hasError) { var errors = ''; for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') errors += $('<div />').html(jsonData.errors[error]).text() + "\n"; if (!!$.prototype.fancybox) $.fancybox.open([ { type: 'inline', autoScale: true, minHeight: 30, content: '<p class="fancybox-error">' + errors + '</p>' }], { padding: 0 }); else alert(errors); $('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val()); } else { if (jsonData.refresh) location.reload(); updateCartSummary(jsonData.summary); if (window.ajaxCart != undefined) ajaxCart.updateCart(jsonData); if (customizationId !== 0) updateCustomizedDatas(jsonData.customizedDatas); updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); if (typeof(getCarrierListAndUpdate) !== 'undefined') getCarrierListAndUpdate(); if (typeof(updatePaymentMethodsDisplay) !== 'undefined') updatePaymentMethodsDisplay(); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { if (textStatus !== 'abort') { error = "TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus; if (!!$.prototype.fancybox) $.fancybox.open([ { type: 'inline', autoScale: true, minHeight: 30, content: '<p class="fancybox-error">' + error + '</p>' }], { padding: 0 }); else alert(error); } } }); }