[ic] Update price to reflect options on flypage

Doug Alcorn doug at lathi.net
Thu Oct 16 14:59:57 EDT 2003

james <james at scotwebshops.com> writes:

> I have an item which has a material option that adds on an extra
> cost, e.g.
> Silver - £100 (base price)
> 8crt Gold (add £50)
> 18crt Gold (add £250)
> Ideally once selecting an option the dropdown would reflect the
> choice so the options from above would then look like...
> Silver (deduct £50)
> 8crt Gold
> 18crt Gold (add £200)
> Saving the user from doing any mental maths.

> I'm thinking this would probably require the <select> to post the
> form to the same page and then a perl method that manually
> calculated the new price before display. However, I am stuck as
> where I can obtain the added cost value that the user has selected.

I think you're on the right track here.  I'm doing something similar,
but somewhat different.  As usual with my advice, there's probably an
easier way to do it ;-)

I created a usertag to compute my item's price.  It actually does the
fetches out of the database from several tables to compute the final
price.  In my flypage I just call my tag instead of the [item-price]
tag.  The other thing I had to do was figure out a good use of the
[discount] tag so that the price will be right in the basket and
checkout pages.  I actually apply the discount on the basket page.

I think I'd use a second usertag to calculate the price delta based on
what option was currently selected.  Then when you are looping through
the options just call that usertag with the current item, the
currently selected option, and the option to calculate.

Yes, I think you'll need to re-post the page to get the updates.  You
could probably have some IC code generate JavaScript for you.  That
would keep you from having to re-post; however, if the customer has JS
turned off... 

This whole thing seems a little tricky, but doable.
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo / PGP 02B3 1E26 BCF2 9AAF 93F1  61D7 450C B264 3E63 D543
 |_/  mailto:doug at lathi.net http://www.lathi.net
      mailto:tarpit at lathi.net is a spam trap

More information about the interchange-users mailing list