Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-23-2007 20:18:11

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Big time help with shipping script Destination flat + Price total USA

Hello,

I've got a shipping script for use in the United States, it's based on the item price (if this much or less than that, then this amount).

Now we want to ship to the UK with a flat rate for the first item and a certain amount for each additional item. And Canada too with the same way as the US but with different amounts.


Code:

#########
######### This custom script calculates shipping
######### based on total item cost. Items
######### over a subtotal of CURR 50.00 are free.
#########
######### Custom scripts may apply to a whole
######### order if all of the items ordered
######### use the same shipping method (Custom)
######### and the same script selection.  Scripts
######### are built to handle a group of like
######### items.
#########
######### A listing of available variables:
#########
######### $item_quantity      Total quantity of items
######### $item_subtotal      Subtotal for all items
######### $item_total_weight  Total weight of all items
#########
######### Directly below, enter in the name for this
######### method to be displayed to the user.
#########

my $ship_meth_name = "UPS Ground";
my $ship_total = "0.00";
my $ship_display = "";

#########
######### Figure out what the shipping charge will be by
######### using if statements and less than/greater than
######### logic.
#########

if ($item_subtotal >= "0" && $item_subtotal <= "100.00") {

$ship_total = "7.00";
$ship_display = "$ship_meth_name - $currency_symbol$ship_total";

} elsif ($item_subtotal > "101.00" && $item_subtotal < = "200.00") {

$ship_total = "11.00";
$ship_display = "$ship_meth_name - $currency_symbol$ship_total";

} elsif ($item_subtotal > "201.00" && $item_subtotal <= "300.00") {

$ship_total = "15.00";
$ship_display = "$ship_meth_name - $currency_symbol$ship_total";

} elsif ($item_subtotal > "301.00" && $item_subtotal <= "500.00") {

$ship_total = "19.00";
$ship_display = "$ship_meth_name - $currency_symbol$ship_total";

} elsif ($item_subtotal > "501.00" && $item_subtotal <= "15000.00") {

$ship_total = "25.00";
$ship_display = "$ship_meth_name - $currency_symbol$ship_total";


} else {

$ship_total = "0.00";
$ship_display = "$ship_meth_name - FREE";

} ######### End of if statement.

#########
######### Format the $ship_total as a price.
#########

$ship_total = sprintf("%.2f", $ship_total);

#########
######### Return the HTML in the variable
######### $custom_code_result.
#########

$custom_code_result = "";

$custom_code_result .= <<ENDOFTEXT;

<INPUT TYPE="RADIO" NAME="shipinfo-$shipid" VALUE="$ship_meth_name:$ship_total" CHECKED>
 $ship_display<br/>

ENDOFTEXT

Thank you for your help. I've seen this on the site before but I can't find it.

Offline

 

Board footer