[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Re: CommonAdjust calculated price
- Subject: [ic] Re: CommonAdjust calculated price
- From: interchange-users@icdevgroup.org (Daniel A. Shockley)
- Date: Sat Nov 9 00:24:00 2002
- In-reply-to: <20021015160003.28984.96674.Mailman@linux20118>
- References: <20021015160003.28984.96674.Mailman@linux20118>
> > 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?
>
>CommonAdjust [calc_price]
>
>where [calc-price] is a UserTag which calculates the price for
>a given item and its quantity, both found in Vend::Interpolate::item.
>
>Search the archives for a sample implementation of calc_price.
>
>Bye
> Racke
Well, I've worked at this for a while, and I'm getting stuck.
I've got this in my catalog.cfg - I had the same problem with
[insc_price] in CommonAdjust, as Racke advised:
PriceField 0
CommonAdjust "& $Tag->insc_price($item->{code}, $item->{quantity},
$item->{inscription})"
UserTag insc_price Interpolate
UserTag insc_price Order code quantity inscription
UserTag insc_price Routine <<EOR
sub {
my ($sku, $quantity, $inscription) = @_;
my $price = $Tag->data( {
table => 'products',
field => 'price',
key => $sku,
});
return $quantity*($price+ $quantity*1.50*length($inscription));
}
EOR
If I put [insc_price code="[item-sku]" quantity="[item-quantity]"
inscription="[item-modifier inscription]"] in an HTML page, it
displays the proper amount in that tag, but it doesn't seem to get
through to CommonAdjust.
Any evidence of why in the code I posted?
Thank you,
--
----
Daniel A. Shockley
DanielAShockley@yahoo.com
dan@danshockley.com
http://www.danshockley.com