type:
snippet
category:
shipping
name:
Australia TNT Rate Requests.
reference:
http://forum.foxycart.com/comments.php?DiscussionID=1983&page=1
tags:
snippets, shipping, advance
date:
2011-05-27

Australia TNT Rate Requests

function sendTNTRequest(request_data, target) {
    $.getJSON("http://<my_domain>/<my_script>/?data=" + $.jSONToString(request_data) + "&callback=?", function(quote) {
        if (quote.error) {
            showError(ERROR + "\n\nReason: " + quote.error)
        }
        else {
            // this request is either from the cart page
            if ($(target).attr("id") == "cart-shipping-cost") {
                $(target).html("$" + quote.cost)
            }
            // ...or the checkout page
            else {
                // update the shipping cost
                FC.checkout.config.orderFlatRateShipping = quote.cost
                // display the new order total
                FC.checkout.updatePrice(-1)
            }
        }
    })
}

Site Tools