[Resolved] Shipping Calculator

Highlighted
New Member
2 0 0

Hi,

I've been trying to figure out for a while why my shipping calculator isn't working. Finally, I came across this at the very end of the shipping calculator wiki:

"They are known incompatibilities between this solution and the following themes: Couture, Expo. Those incompatibilities have been fixed in said themes if you grab a fresh copy from the theme store."

http://wiki.shopify.com/Adding_a_shipping_rates_calculator_to_your_cart_page#Incompatibilities

 

I have the Expo template. I guess this might be a dumb question, but how do I "grab a fresh copy from the theme store"?

 

Thanks.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 314

I think i fixed your calculator today in Support, I remember you! :-)

http://www.petsbestmiami.com/cart

I can't quite remember what I did to fix it ( if anyone stumbles on this ).

Too many tickets!!!

Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
0 Likes
Highlighted
New Member
2 0 0

Yes thank you again for helping me :) I'll post part of the email you sent me below, in case anybody has the same issue:

 

"I updated the jquery.cart.min.js file in your theme assets with what I have on github now: https://github.com/carolineschnapp/shipping-calculator/blob/master/jquery.cart.min.js and it fixed the problem!"

 

In case that link doesn't work in the future, here is the code:

 

/**
 * Module to add a shipping rates calculator to cart page.
 *
 * Copyright (c) 2011-2012 Caroline Schnapp (11heavens.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

if(typeof Countries==="object"){Countries.updateProvinceLabel=function(d,a){if(typeof d==="string"&&Countries[d]&&Countries[d].provinces){if(typeof a!=="object"){a=document.getElementById("address_province_label");if(a===null){return}}a.innerHTML=Countries[d].label;var c=$(a).parent();var b=c.find("select");c.find(".custom-style-select-box-inner").html(Countries[d].provinces[0])}}}if(typeof Shopify.Cart==="undefined"){Shopify.Cart={}}Shopify.Cart.ShippingCalculator=(function(){var _config={submitButton:"Calculate shipping",submitButtonDisabled:"Calculating...",templateId:"shipping-calculator-response-template",wrapperId:"wrapper-response",customerIsLoggedIn:false,moneyFormat:"$ {{amount}}"};var _render=function(response){var template=jQuery("#"+_config.templateId);var wrapper=jQuery("#"+_config.wrapperId);if(template.length&&wrapper.length){template.tmpl(response).appendTo(wrapper);if(typeof Currency!=="undefined"&&typeof Currency.convertAll==="function"){var newCurrency="";if(jQuery("[name=currencies]").size()){newCurrency=jQuery("[name=currencies]").val()}else{if(jQuery("#currencies span.selected").size()){newCurrency=jQuery("#currencies span.selected").attr("data-currency")}}if(newCurrency!==""){Currency.convertAll(shopCurrency,newCurrency,"#wrapper-response span.money, #estimated-shipping em span.money")}}}};var _enableButtons=function(){jQuery(".get-rates").removeAttr("disabled").removeClass("disabled").val(_config.submitButton)};var _disableButtons=function(){jQuery(".get-rates").val(_config.submitButtonDisabled).attr("disabled","disabled").addClass("disabled")};var _getCartShippingRatesForDestination=function(shipping_address){var params={type:"GET",url:"/cart/shipping_rates.json",data:jQuery.param({shipping_address:shipping_address}),dataType:"json",success:function(response){rates=response.shipping_rates;_onCartShippingRatesUpdate(rates,shipping_address)},error:function(XMLHttpRequest,textStatus){_onError(XMLHttpRequest,textStatus)}};jQuery.ajax(params)};var _fullMessagesFromErrors=function(errors){var fullMessages=[];jQuery.each(errors,function(attribute,messages){jQuery.each(messages,function(index,message){fullMessages.push(attribute+" "+message)})});return fullMessages};var _onError=function(XMLHttpRequest,textStatus){jQuery("#estimated-shipping").hide();jQuery("#estimated-shipping em").empty();_enableButtons();var feedback="";var data=eval("("+XMLHttpRequest.responseText+")");if(!!data.message){feedback=data.message+"("+data.status+"): "+data.description}else{feedback="Error : "+_fullMessagesFromErrors(data).join("; ")}if(feedback==="Error : country is not supported."){feedback="We do not ship to this destination."}_render({rates:[],errorFeedback:feedback,success:false});jQuery("#"+_config.wrapperId).show()};var _onCartShippingRatesUpdate=function(rates,shipping_address){_enableButtons();var readable_address="";if(shipping_address.zip){readable_address+=shipping_address.zip+", "}if(shipping_address.province){readable_address+=shipping_address.province+", "}readable_address+=shipping_address.country;if(rates.length){if(rates[0].price=="0.00"){jQuery("#estimated-shipping em").html("FREE")}else{jQuery("#estimated-shipping em").html(_formatRate(rates[0].price))}}_render({rates:rates,address:readable_address,success:true});jQuery("#"+_config.wrapperId+", #estimated-shipping").fadeIn()};var _formatRate=function(cents){if(typeof cents=="string"){cents=cents.replace(".","")}var value="";var patt=/\{\{\s*(\w+)\s*\}\}/;var formatString=_config.moneyFormat;function addCommas(moneyString){return moneyString.replace(/(\d+)(\d{3}[\.,]?)/,"$1,$2")}function floatToString(numeric,decimals){var amount=numeric.toFixed(decimals).toString();if(amount.match(/^\.\d+/)){return"0"+amount}else{return amount}}switch(formatString.match(patt)[1]){case"amount":value=addCommas(floatToString(cents/100,2));break;case"amount_no_decimals":value=addCommas(floatToString(cents/100,0));break;case"amount_with_comma_separator":value=floatToString(cents/100,2).replace(/\./,",");break;case"amount_no_decimals_with_comma_separator":value=addCommas(floatToString(cents/100,0)).replace(/\./,",");break}return formatString.replace(patt,value)};_init=function(){new Shopify.CountryProvinceSelector("address_country","address_province",{hideElement:"address_province_container"});var countriesSelect=jQuery("#address_country");var addressProvinceLabelEl=jQuery("#address_province_label").get(0);if(typeof Countries!=="undefined"){Countries.updateProvinceLabel(countriesSelect.val(),addressProvinceLabelEl);countriesSelect.change(function(){Countries.updateProvinceLabel(countriesSelect.val(),addressProvinceLabelEl)})}jQuery(".get-rates").click(function(){_disableButtons();jQuery("#"+_config.wrapperId).empty().hide();var shippingAddress={};shippingAddress.zip=jQuery("#address_zip").val()||"";shippingAddress.country=jQuery("#address_country").val()||"";shippingAddress.province=jQuery("#address_province").val()||"";_getCartShippingRatesForDestination(shippingAddress)});if(_config.customerIsLoggedIn){jQuery(".get-rates:eq(0)").trigger("click")}};return{show:function(params){params=params||{};jQuery.extend(_config,params);jQuery(function(){_init()})},getConfig:function(){return _config},formatRate:function(cents){return _formatRate(cents)}}})();

0 Likes
Highlighted
New Member
2 0 0

I just updated my query.cart.min.js file and it still does not work.

I'm currently using the Radiance theme which wasn't on the list of incompatible themes.

Any other suggestions?

thanks!

0 Likes
Highlighted
New Member
28 0 0

We're using the Mobilia theme, same issue!

Thoughts?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 314

Hi Young Alexander! Do you have a link to your website that uses Radiance? I will take a look.

Hi Sayta, your shipping calculaqtor works fine now on my end: http://www.satyatea.com/cart. Has this been resolved?

Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
0 Likes
Highlighted
Explorer
45 0 23

I am using the Mobilia theme, as well, and the shipping calculator pulls the flat rate shipping methods I have set-up, but not the expedited UPS rates that I have set-up.

Do you know why this would be? Any help would be greatly appreciated!

0 Likes
Highlighted
Explorer
45 0 23

*Sorry! This has been corrected. I realized that only when the cart had an item with no weight, UPS rates did not display.

0 Likes
Highlighted
New Member
1 0 0

Hi Caroline,

I'm using the "radiance" theme as well and followed all the steps to install the calculator but it doesn't work when I click on "Calculate shipping". Can you please take a look and let me know if I missed anything?

Much appreciated!

0 Likes
Highlighted
New Member
1 0 0

Hi Caroline,

I'm having problems as well with this integration on the Flex theme. I see it in the shopping cart, can select and click, but then it quickly switches to the calculate button and then nothing happens. We just have tiered shipping based on spend. Ideas?

Thanks!

0 Likes