473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Online Store - Product Options, Updating Prices

13 New Member
Hi All,

I am creating an online store kind of thing, in the backend you can specify product options, such as color, disk space etc etc..

On the frontend it outputs the options into a select box as below;

Expand|Select|Wrap|Line Numbers
  1. <select name="options" id="options" onchange="UpdateDisplay(this.options[this.selectedIndex].value)"> 
  2.   <option value="0">-- Base Product --</option>
  3. <!-- Option Value = Option ID -->
  4.   <option value="17">1.60GHz Intel Core 2 Duo (Included in price)</option>
  5.   <option value="18">1.80GHz Intel Core 2 Duo (add &euro; 296.89)</option>
  6. </select>                    
  7.  
The onchange event triggers the script below;

Expand|Select|Wrap|Line Numbers
  1. case (id = "<%=rs1("id_value")%>"):
  2.  document.getElementById('checkout_button').innerHTML = '<input type="submit" name="buy" class="button-buy-big" alt="Buy" value="Buy" />';
  3.  document.getElementById('store_price').innerHTML = parseInt(document.getElementById('store_price').innerHTML) + parseInt(<%=rs1("price_impact_amt")%>);
  4.  document.getElementById('store_stock').innerHTML = '<img alt="In Stock" border="0" src="assets/images/template/theme_blue/icons/stocked.gif""> <%=Int(rs1("quantity"))%> stocked';
  5. break
  6.  
The above javascript, changes the checkout button (disables it if out of stock for that option), if its not out of stock it updates the quantity and updates the price.

The price is held in a <span> tag that looks like this;
Expand|Select|Wrap|Line Numbers
  1. <span id="store_price">1,799.00</span>
  2.  
The problem is, when i select the option it firstly does not append the original price, instead of running 1,799.00 + Option Amount it just appends Option Amount.

The main problem is that after it does this, it the user changes the option it will just append the new price onto the old total. which means the total still includes the option they just changed.

So to summarize, what i need to fix is;
  • I need it so that when the user selects an option, it will add the option amount to the "store_pric e" price.
  • I need it so when the user changes the option, it subtracts the original option amount and then appends the new one.

All help appreciated, i have spent way to much time trying to fix this..
Aug 8 '08 #1
2 1518
Sinister747
13 New Member
Anybody wanna give this a try?
Aug 9 '08 #2
Sinister747
13 New Member
Nevermind, i got this problem solved. If anyone else is having this problem, i just edited the source code of the below example;

http://www.intranetjou rnal.com/corner/configurator.ht ml
Aug 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
3670
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
5
2064
by: PR | last post by:
Searchable product images + prices database? What system should I use to put a database on the WEB which shows images and allows searches, including searches within given price ranges for products? There will be product images too, thumbnails and larger images? All the data will be on a single server, on the same
15
2643
by: Colin | last post by:
I have a query that calculates the selling price of products on customer orders. Selling prices are calculated based on the average cost of the items when purchased. As I make new purchases, the product cost changes (as it should) to reflect the new average cost. However, the problem is that the selling price of previously sold items also...
2
1215
by: Eddie Stone | last post by:
I've been tasked to produce some system wherby affiliates can display our products on their website. At the moment affiliates are simply mirroring the site and there is no organisation. I said I could improve on this and add a consistent, convenient system for supplying the latest products to our affiliates. Little did I know that they'd go...
10
4250
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version. Because of this, I am unable to store these settings in the App.Config file, as this gets updated every time the application does, and there...
1
1956
by: giloosh | last post by:
i would like to dynamically output such a selectbox below using php and mysql: <select> <option< 100 </option> <option100 to 150 </option> <option150 to 200 </option> <option200 to 250 </option> <option250 to 300</option> <option 300 </option> </select>
2
1584
by: ptoussis | last post by:
Hello, I am producing a product which consists of say 3 components(they are many more). I buy these components some times in $ some others in € or whatever. I want to store these prices and the currency rate I buy in, so that I can later make "sum" calculations etc. Please also note that there are several suppliers for each component and so I...
0
2689
by: raylopez99 | last post by:
10 years ago, the below was written (see very end, after my signature RL). What, if anything, has changed? I have Access 2003 and soon Access 2007 on a Windows XP Professional or Windows Vista Ultimate machine, with SQL Server Express running on it, and I want somebody, with a password (which I will provide) to be able to log onto a A03...
3
2726
by: Reg Verrin | last post by:
I have a program that displays constantly changing prices which it sources from the web once per second. The prices are displayed on a Listbox (not the best choice but there are good reasons for this). The Listbox flickers when updating and I can't find a solution on the net. Here is the code: 'update Listbox
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.