Previous Thread
Next Thread
Print Thread
#145114 06/27/03 04:51 PM
Joined: Jan 2005
Posts: 1
OP Offline
Joined: Jan 2005
Posts: 1
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?

Sponsored Post Advertisement
#145115 07/14/03 01:59 PM
Joined: Sep 2004
Posts: 1
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


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 

Link Copied to Clipboard
Brand New Posts
Psalm for the day
by Angie - 06/19/24 09:50 PM
Decorative Machine Buttonholes
by Cheryl - Sewing Editor - 06/19/24 04:49 PM
Inspiration Quote
by Angie - 06/19/24 10:13 AM
Girl 27 - New Film Review
by Angela - Drama Movies - 06/16/24 04:13 PM
2024 - on this day in the past ...
by Angie - 06/15/24 09:22 PM
New Film From "Blackfish" Director
by Angela - Drama Movies - 06/14/24 06:31 PM
Fun Western Wear
by Cheryl - Sewing Editor - 06/12/24 03:50 PM
Curiosity and Learning
by Angie - 06/11/24 08:37 PM
A Designed Container Garden
by Angie - 06/11/24 08:24 PM
Amaryillis for a Regal Container
by Lestie4containergardens - 06/11/24 07:13 AM
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!
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!

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

Powered by UBB.threads™ PHP Forum Software 7.7.5