logo

Previous Thread
Next Thread
Print Thread
Help with ASP array #145114 06/27/03 08:51 PM
Joined: Jan 2005
Posts: 1
marie-lou Offline OP
Newbie
OP Offline
Newbie
Joined: Jan 2005
Posts: 1
Hi,
I am trying to create some asp code for a instant quote on a website.
Basically what I need to know is, how to code a lookup table.
Example: If someone orders 10 shirts and want 2 colors on the front, I need to beable to look up how much it will cost per shirt to have 2 colors.
10 shirts - 2 colors would be 3.10, but 13 shirts with 3 colors would be 3.00 and so on (12 colors and 11 different quantity fields, which total 132 different amounts).
Can this be easily done with a if then statement?


M.L.
Re: Help with ASP array #145115 07/14/03 05:59 PM
Joined: Sep 2004
Posts: 1
pureheart Offline
Newbie
Offline
Newbie
Joined: Sep 2004
Posts: 1
You can't just look it up - you'd have to create a gigantic array with every single combination in it! That would be a nightmare.

The way that most people would do this is to handle each condition separately.

So first, you determine the price for a single shirt. Say that a shirt costs $7.50 base. You would say

shirt = 7.50

then say that each additional color you add on adds another 40 cents to the shirt. So you would say

ColorAdd = ColorCount * .40

and

Shirt = Shirt + ColorAdd

Now you know how much that shirt costs with however many colors the user wanted. Finally, you just multiply times the number of shirts they want

ShirtTotal = Shirt * ShirtCt


P. Pureheart

Moderated by  Lisa LowCarb 

Brand New Posts
2020: On this day . . .
by Mona - Astronomy - 11/29/20 09:50 AM
Container Gardening TIP OF THE DAY
by Lestie4containergardens - 11/29/20 05:13 AM
Native American Heritage Month
by Angela - Drama Movies - 11/29/20 01:25 AM
Advent 2020
by Angie - 11/28/20 11:18 PM
Thanksgiving and Gratitude
by Angie - 11/28/20 01:36 PM
Meanwhile in Canada
by Angie - 11/28/20 01:34 PM
Thanksgiving in Space
by Angie - 11/28/20 01:30 PM
The Solar System - for Kids & Others
by Mona - Astronomy - 11/28/20 12:39 PM
Uranus - Facts for Kids *new article*
by Mona - Astronomy - 11/28/20 12:36 PM
Sewing Ideas Towards Best Fit
by Cheryl - Sewing Editor - 11/25/20 09:36 PM
Privacy
This forum uses cookies to ensure smooth navigation from page to page of a thread. If you choose to register and provide your email, that email is solely used to get your password to you and updates on any topics you choose to watch. Nothing else. Ask with any questions!
Channel List
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies
Safety
We take forum safety very seriously here at BellaOnline. Please be sure to read through our Forum Guidelines. Let us know if you have any questions or comments!
Sponsor


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2020 Minerva WebWorks LLC. All rights reserved.


Powered by UBB.threads™ PHP Forum Software 7.7.3