shopping cart

Discussion in 'ASP General' started by John Smith, Jul 10, 2003.

  1. John Smith

    John Smith Guest

    Hi,

    I'm trying to work out the postage rate for products in a shopping cart.
    Predictably there is no formula for working out the postage rate (ie. 0.20 *
    weight). The problem i'm having is with the statement for working this out

    There are different 'bands' for the weight (i.e. between 150g and 200g the
    price is 0.50). What's the best way to write a statement for this ? I have
    tried different ways of writing an If statement but they all end up in
    chaos.

    John
     
    John Smith, Jul 10, 2003
    #1
    1. Advertising

  2. Use a database table. Assuming SQL Server:



    CREATE TABLE postageRates
    (
    weightlowerbound INT,
    weightupperbound INT,
    rate DECIMAL(19,2)
    )

    INSERT postageRates VALUES(0, 149, 0.25)
    INSERT postageRates VALUES(150, 200, 0.50)
    INSERT postageRates VALUES(201, 500, 0.85)
    -- ...

    DECLARE @weight INT
    SET @weight = 172
    SELECT rate FROM postageRates
    WHERE @weight
    BETWEEN weightlowerbound AND weightupperbound

    DROP TABLE postageRates



    You could also do this within an array in ASP...



    "John Smith" <> wrote in message
    news:beken4$pi4$...
    > Hi,
    >
    > I'm trying to work out the postage rate for products in a shopping cart.
    > Predictably there is no formula for working out the postage rate (ie. 0.20

    *
    > weight). The problem i'm having is with the statement for working this out
    >
    > There are different 'bands' for the weight (i.e. between 150g and 200g the
    > price is 0.50). What's the best way to write a statement for this ? I have
    > tried different ways of writing an If statement but they all end up in
    > chaos.
    >
    > John
    >
    >
     
    Aaron Bertrand - MVP, Jul 10, 2003
    #2
    1. Advertising

  3. John Smith

    John Smith Guest

    works great, thanks !


    "Aaron Bertrand - MVP" <> wrote in message
    news:%...
    > Use a database table. Assuming SQL Server:
    >
    >
    >
    > CREATE TABLE postageRates
    > (
    > weightlowerbound INT,
    > weightupperbound INT,
    > rate DECIMAL(19,2)
    > )
    >
    > INSERT postageRates VALUES(0, 149, 0.25)
    > INSERT postageRates VALUES(150, 200, 0.50)
    > INSERT postageRates VALUES(201, 500, 0.85)
    > -- ...
    >
    > DECLARE @weight INT
    > SET @weight = 172
    > SELECT rate FROM postageRates
    > WHERE @weight
    > BETWEEN weightlowerbound AND weightupperbound
    >
    > DROP TABLE postageRates
    >
    >
    >
    > You could also do this within an array in ASP...
    >
    >
    >
    > "John Smith" <> wrote in message
    > news:beken4$pi4$...
    > > Hi,
    > >
    > > I'm trying to work out the postage rate for products in a shopping cart.
    > > Predictably there is no formula for working out the postage rate (ie.

    0.20
    > *
    > > weight). The problem i'm having is with the statement for working this

    out
    > >
    > > There are different 'bands' for the weight (i.e. between 150g and 200g

    the
    > > price is 0.50). What's the best way to write a statement for this ? I

    have
    > > tried different ways of writing an If statement but they all end up in
    > > chaos.
    > >
    > > John
    > >
    > >

    >
    >
     
    John Smith, Jul 10, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GeorgeF

    Perl Shopping Cart Scripts

    GeorgeF, May 21, 2005, in forum: Perl
    Replies:
    1
    Views:
    3,260
    James T
    May 22, 2005
  2. Bruce W...1

    Secure shopping cart example?

    Bruce W...1, Aug 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    600
    Bruce W...1
    Aug 27, 2003
  3. Mark Fox

    Shopping Cart Component Suggestions

    Mark Fox, Nov 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    382
    Jacob Yang [MSFT]
    Nov 4, 2003
  4. John
    Replies:
    1
    Views:
    369
    George Shubin
    Nov 7, 2003
  5. Paul Hobbs

    Shopping Cart - database vs session

    Paul Hobbs, Dec 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,764
    Jaxon
    Dec 4, 2003
Loading...

Share This Page