function for shipping charges?

# Thread: function for shipping charges?

1. Junior Member
Join Date
Dec 1969
Posts
19

## function for shipping charges?

Hi there,<BR><BR>I have an application where I need to calculate shipping charges. i.e. if quantity = 2-4 then strShipping = \$11.95, 5-7 then strShipping = \$14,95, etc. I know just enough about functions to be dangerous. Is there a way to build a function that can be called when the total is being added up for the total that if the oRs("qty")=whatever then shiping = &#060;%=strShipping%&#062;<BR><BR>I&#039;d appreciate any thoughts you have. Thanks!

2. Junior Member
Join Date
Dec 1969
Posts
15

## RE: function for shipping charges?

I didnt get real detailed but this is a quicky for yah. If this is what your after i can get more detailed for yah.<BR><BR>&#060;%<BR>DIM qty, shp<BR>qty = request.querystring("qty") &#039;oRs("qty")<BR>strShipping1 = "9.95"<BR>strshipping2 = "11.95"<BR>strshipping3 = "14.95"<BR>if qty = 1 then<BR>shp = strShipping1<BR>Else<BR>shp = strShipping2<BR>If qty &#062; 4 then<BR>shp = strShipping3<BR>End If<BR>End If<BR>%&#062;<BR>&#060;% = shp %&#062;<BR><BR>Hope this helps!

3. Member
Join Date
Dec 1969
Posts
62

## RE: function for shipping charges?

Try This:<BR><BR>Function ShipCost(qnty)<BR> If qnty &#062;= 4<BR> ShipCost=14.95<BR> ElseIf (qnty &#062;= 2) Then<BR> ShipCost=11.95<BR> ElseIf (qnty &#060; 2) Then<BR> ShipCost=9.95<BR> End If<BR>End Function<BR><BR>to call it (incidentally, this returns a number which seems to make more sense than a string)<BR>variable_name=ShipCost(oRs("qty"))

4. Junior Member
Join Date
Dec 1969
Posts
19

## RE: function for shipping charges?

Hey, I think that will work! Thanks a lot.

5. Junior Member
Join Date
Dec 1969
Posts
19

## RE: function for shipping charges?

I like that too. Thanks very much to both of you!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•