Forum Moderators: coopster

Message Too Old, No Replies

Help with shipping calculation

         

michlcamp

9:31 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



I've got to add another condition to my shipping calculation - right now it reads:
[2] 
if ($total > 81.75)
{printf ("%01.2f", $total * .11);}
else {echo "8.99 ";}
[/2]

The condition I need to add needs to accomodate International shipping - $total * .25

I have a field for '$shipcountry' - the new condition needs to identify whether the order is being shipping with USA or goes to another country... :

something like....

[2]
IF $shipcountry = "USA",
THEN DO USE CODE ABOVE
ELSE $total * .25
[/2]

It looks like a couple of IFs AND then ELSE to me...just wish I knew how to write it...

any help appreciated in advance..
mc

jatar_k

10:15 pm on Jan 19, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am assuming this is a shipping cost only and you need to maintain the value of $total

I am also guessing you want all of the first code in your if and only the multiplication in your else therefore

if ($shipcountry == "USA") { 
if ($total > 81.75) $ship = $total * .11;
else $ship = '8.99';
} else {
$ship = $total * .25;
}
echo $ship,' ';

something like that?