Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function to spit out shipping charges

Status
Not open for further replies.

loveday

Programmer
Sep 19, 2004
106
US
Hello gurus,

Can I ask for a big favor of you, please.

I created 2 tables:

One table is called shipping and another is called products.

The products table houses all of our products including shippingWeight of each product.

The shipping table is a lookup table for shippingWeight.

It has weight ranges that starts from 1 like:

1lb - 5lbs with a given zipcode = a certain shipping charges.

Weights are from 1 to 150.

Anything over 150 gets a fixed shipping charges.

Basically, a customer adds an item to his or her cart.

During checkout, the total amount of shippingWeight for all items are tabulated.

Can someone get me going on this, please?

Basically, we will pass in the shipping weight, the zipcode and an active connection to the function and the function will spit out the shipping charges.

Any help is greatly appreciated
 
Try using a CASE statement...

something like this...


SELECT
CASE Shippingcharge
WHEN products.ShippingWeight BETWEEN 1 AND 15 THEN '$5'
WHEN products.ShippingWeight BETWEEN 16 AND 50 THEN '$15'
WHEN products.ShippingWeight BETWEEN 50 AND 100 THEN '$25'
WHEN products.ShippingWeight BETWEEN 100 AND 150 THEN '$35'
Else '50'
End

-L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top