[ic] CommonAdjust calculated price
Kevin Walsh
interchange-users@icdevgroup.org
Sun Oct 20 13:08:00 2002
Daniel A. Shockley [danielashockley@yahoo.com] wrote:
>
> I need to add an additional calculated (not static as Options
> typically are) charge to an item in a cart. The problem is that the
> additional amount charged is based on the number of characters typed
> into a text field that is part of an Option.
>
> I wrote perl code that can calculate the amount I need to add. It's
> just not clear to me where I need to add this. Do I need to create an
> Option for every possible character count: 1 through MY_LIMIT, or can
> I include this in a scratch variable that CommonAdjust can parse in
> the price chaining process?
>
> I can see how to have CommonAdjust lookup a static price for an
> Option, but the price is based on the LENGTH of what was typed in,
> not on an option chosen from a Select popup. I can calculate the
> additional price using perl, of course, but how do I get CommonAdjust
> to see that price?
>
You could put your Perl into a UserTag and call it using a CommonAdjust
atom such as "&$Tag->yourtag()". The value returned will be added to
the item's price. Your Perl code can use the $Vend::Interpolate::item
hashref to look at the current item in the cart.
See section 2.2 (Price Maintenance with CommonAdjust) of the
"Interchange E-Commerce Functions" manual for a better explanation
of the "&" atom.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/