473,736 Members | 1,732 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 1528
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
3689
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
2071
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
2666
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 change when new purchases are made. Keep in mind that I'm not storing any calculated values anywhere....
2
1219
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 for it ! I have several options I think
10
4265
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 doesn't appear to be a way of preventing this. Most of my application settings are kept in the...
1
1963
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
1600
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 maybuy component1 in $, component 2 in € and so on. How can I input either $ or € or whatever...
0
2698
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 or A07 dB from the internet. Now that I type this I realize that unless I put the database onto a...
3
2729
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
8786
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9466
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9202
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6748
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6050
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4567
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.