[ic] options

Fred Pope interchange-users@interchange.redhat.com
Mon Oct 29 10:36:01 2001


HOW TO

Find the form that controls the simple options page in the admin. Using your
favorite editor, open up the file template called item_option_simple. We
used vi to edit the file.

Add a form input field to that form that references the price wherever you
see fit. I did it after the textarea entry. The Code that I added reads as
follows:
<tr>
	<td> Price: <input type="text" name="opt_price_[scratch mod_code]"
size="50" value="[filter entities][sql-param price][/filter]"></td>
</tr>

This will add it to the edit templates.

Then you are going to modify the query up above that inserts the data.

First you need to define the variable for the query so add this line:

my $price = $CGI->{"opt_price_$key"};

This line goes right under the three others that are defining name, value
and label.

Then a ways further down, in the SQL set statements add:

$odb->set_field($key,'price',$price);

Finally towards the very bottom you need to add this line for the add new
option dialog below the textarea and aboe the input button.
Price:<Input type="text" name="opt_price_" size"30"><br>

Now say you have a product that is a car. The car is avaliable in three
colors, Red Blue and Green which add to the price 50,100&150 respectively.

In the text areas you might enter the following values:

Name: CLR
Label: Color
Values: 	R=Red
		B=Blue
		G=Green
Price:	R=50,B=100,G=150

Now when you select these options, it will automatically configure the price
when you add the item to the basket. Our next task is too add some
javascript that will automatically calculate the price as the user select
the options.

If you would like to see an example of how this works on the output, you can
go to our page at http://www.satcomresources.com and search for dst300, and
then click on the DST300 Ku-Band Satellite Terminal and you will see how you
can configure the unit, and the price is automatically calculated.
Interchange fully supports this, but it was just not built into the admin
yet.

Good Luck.
--
Fred Pope
Satcom Resources
970-748-3094
fred@satcomresources.com
http://www.satcomresources.com