[ic] Javascript Updating of Configured Price with Simple Options.

Fred Pope interchange-users@interchange.redhat.com
Tue Nov 6 11:50:01 2001


**Platform
RH 7.2 / IC 4.8.2 / PGSQL

**Interchange Topics
Options
Interchange Tags

**Overview
We have written some Javascript that allows the user to see the configured
price of a product with multiple options. For example, if they are buying a
car with a base price of $11,000, and adding the CD player costs $100, upon
selecting to add the CD player on the flypage from the options dropdown,
this will adjust the "configured" price to $11,100 without having to click
the buy now feature to see the configured price in the cart. As the user
selects the various options, this automatically recalculates the configured
price. This allows the user to quickly price out different configurations.
We are using an additional input on the form with the default value of
[item-price], and the Javascript updates this input on the form with a
function that we wrote called update_total.

**Desired Goals
We need to add an attribute (..OnChange=update_total(this)..) to the select
statement(s) that is(are) generated on the flypage for each option. We also
need to add this input to that table at the end after it is finished looping
through the options.

**Specific Question
We need to locate the code that generates the form with the select
statements for the options on the flypage so we can modify it slightly.

**Reference Materials / Real Life Example
We need to change the HTML output of the following code:

[table-organize cols=2 table=' ' font="size=1" pretty=1]
	[item-options td=1 label=1 bold=1 price=1]
[/table-organize]

Sample Existing Outputted Code (What we want to change):

<table>
	<tr>
		<td><FONT size=1><B>Waveguide</b></FONT></td>
		<td><FONT size=1><input type=hidden name="mv_item_option" value="WG">
			<SELECT NAME="mv_order_WG">
				<OPTION VALUE="">None
				<OPTION VALUE="3">3 ft Flex Waveguide WR75 ($375.00)												<OPTION
VALUE="6">6 ft Flex Waveguide WR75 ($708.00)
			</SELECT></FONT></td>
	</tr>
	<tr>
		<td><FONT size=1><B>Tx Reject Filter</b></FONT></td>
		<td><FONT size=1><input type=hidden name="mv_item_option" value="TXRF">
			<SELECT NAME="mv_order_TXRF">
				<OPTION VALUE="">None
				<OPTION VALUE="Y">Tx Reject Filter 50db Rejection ($281.00)
			</SELECT></FONT></td>
	</tr>
	<tr>
</table>

Desired Outputted Code (What we want to change too):

<table>
	<tr>
		<td><FONT size=1><B>Waveguide</b></FONT></td>
		<td><FONT size=1><input type=hidden name="mv_item_option" value="WG">
			<SELECT NAME="mv_order_WG" OnChange=update_total(this)>
				<OPTION VALUE="">None
				<OPTION VALUE="3">3 ft Flex Waveguide WR75 ($375.00)												<OPTION
VALUE="6">6 ft Flex Waveguide WR75 ($708.00)
			</SELECT></FONT></td>
	</tr>
	<tr>
		<td><FONT size=1><B>Tx Reject Filter</b></FONT></td>
		<td><FONT size=1><input type=hidden name="mv_item_option" value="TXRF">
			<SELECT NAME="mv_order_TXRF" OnChange=update_total(this)>
				<OPTION VALUE="">None
				<OPTION VALUE="Y">Tx Reject Filter 50db Rejection ($281.00)
			</SELECT></FONT></td>
	</tr>
	<tr>
		<td colspan="2"><B>Configured Price:</b><input type="text"
value=[item-price] name="price"></td>
	</tr>
</table>

Best regards,
--
Fred Pope
Satcom Resources
970-748-3094
fred@satcomresources.com
http://www.satcomresources.com