The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Custom Shipping...

flinx777flinx777 Member
in General edited March 2009
Hey Luke,

Awhile back you helped me put together a custom shopping cart Javascript for the checkout page that would enable my client to be able to customize their shipping price based on a tier system of sorts. Here was that code:
<script type="text/javascript">
var productWeightToWeightPerPound = {
	"50":1.15,
	"100":1,
	"150":.8,
	"200":.7,
	"250":.65,
	"300":.6,
	"350":.55,
	"400":.5,
	"750":.45,
	"1000":.4,
	"1500":.35
}


function calculateShipping(productWeight) {
	var pricePerPound = 1.25;
	var weightArray = new Array();
	var pricePerPoundArray = new Array();
	for (var priceTier in productWeightToWeightPerPound) {
		weightArray[weightArray.length] = parseInt(priceTier);
		pricePerPoundArray[pricePerPoundArray.length] = productWeightToWeightPerPound[priceTier];
	}
	// sort ascending
	weightArray = weightArray.sort(function(a,b){return a - b});
	// sort descending
	pricePerPoundArray = pricePerPoundArray.sort(function(a,b){return b - a});
	for (var i=0; i<weightArray.length; i++) {
		if (weightArray[i] <= productWeight) {
			pricePerPound = pricePerPoundArray[i];
		} else {
			break;
		}
	}
	return (pricePerPound * productWeight);
}

$j(document).ready(function() {
	FC.checkout.override("updatePrice","myUpdatePrice");
	FC.checkout.config.orderShipping = calculateShipping(fc_json.total_weight);
	FC.checkout.updatePriceDisplay();
});

var myUpdatePrice = function() {
	FC.checkout.updatePaymentDisplay();
}
</script>

The problem I've run into is that on checkout, this error message is produced:

Try Again
Error: This store has not been setup correctly to calculate shipping to this location. We apologize for the inconvenience. The store owner has been notified of this error.
undefined


To try and get around this problem, when I login the Admin area of Foxy Cart for this account and look under "Shipping Methods" I choose "Custom Shipping" and then I must choose from either: "Customer Pickup" or "Free Ground Shipping" ... neither one of these fit my client's needs. So now that neither is chosen, a person trying to purchase a product can not. I went ahead and selected the options in the Admin area to have them output on the checkout page, but now obviously that would confusing to the client to have a "Free Shipping" and "Customer Pickup" option. Using CSS I made those options display:none but without one of the two being chosen, an error message is produced when trying to submit the info. What would you suggest I do?

Thanks!
Comments
  • lukeluke FoxyCart Team
    Have you upgraded the store? Has anything changed or has it ever worked? This is unsupported stuff so you'll probably have to hit me up offline and let me login and see what you're trying to accomplish.
Sign In or Register to comment.