Kerm Posted May 8, 2015 Share Posted May 8, 2015 Hello, First i download prestashop from this site and install, and after when i press button add to cart on demo product i see in console error: "hasDeliveryAddress is undefined" in ajax-cart.js. Btw i google about this error and find ppl with same problem on oldest version prestashop like 1.6.1.11.... Okey, i go to prestashop GitHub and download last version of ajax-cart.js, this file smaller than old one btw. With this file when i press button add to cart i go immediately to the cart, no ajax effect, no popup "layer_cart" window like on demo prestashop site with product added. Inside ajax-cart.js code is very different compared to the old file, and no code that open layer_cart popup window. Okey i take old file and search in code "hasDeliveryAddress": if (parseFloat(jsonData.shippingCostFloat) > 0) $('.ajax_cart_shipping_cost').text(jsonData.shippingCost).parent().find('.unvisible').show(); else if ((hasDeliveryAddress || typeof(orderProcess) !== 'undefined' && orderProcess == 'order-opc') && typeof(freeShippingTranslation) != 'undefined') $('.ajax_cart_shipping_cost').html(freeShippingTranslation); else if (!hasDeliveryAddress) $('.ajax_cart_shipping_cost').html(toBeDetermined); if (hasDeliveryAddress) $('.ajax_cart_shipping_cost').parent().find('.unvisible').show(); And i add one more rule: if (typeof hasDeliveryAddress !== 'undefined') { if (parseFloat(jsonData.shippingCostFloat) > 0) $('.ajax_cart_shipping_cost').text(jsonData.shippingCost).parent().find('.unvisible').show(); else if ((hasDeliveryAddress || typeof(orderProcess) !== 'undefined' && orderProcess == 'order-opc') && typeof(freeShippingTranslation) != 'undefined') $('.ajax_cart_shipping_cost').html(freeShippingTranslation); else if (!hasDeliveryAddress) $('.ajax_cart_shipping_cost').html(toBeDetermined); } else { if (parseFloat(jsonData.shippingCostFloat) > 0) $('.ajax_cart_shipping_cost').text(jsonData.shippingCost).parent().find('.unvisible').show(); if (typeof toBeDetermined !== 'undefined') { $('.ajax_cart_shipping_cost').html(toBeDetermined); } } if (typeof hasDeliveryAddress !== 'undefined') { $('.ajax_cart_shipping_cost').parent().find('.unvisible').show(); } "toBeDetermined" btw undefined too.And also code of popup cart window that we see when we add product on page "<div id="layer_cart">...</div>" was in file blockcart.tpl, but who made that know that not all enable this module in top or left/right columns? some ppl like i, use module blockuserinfo for recive cart information in top hook...so i cut and paste this code also inside blockuserinfo file. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now