[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Can't get CommonAdjust to adjust price.
John Murtari wrote:
> Folks,
>
> Have a catalog for a client who wants to support both US and
> Canadian pricing -- except, there is not a straight conversion
> factor. Canadian prices are adjusted by him based on other factors
> unique to the items. Interchange 4.8.6
>
> Wanted to keep things simple for him so his products database has
> the price column (in US dollars), it also has a "caPrice" column
> with the canadian price. He wants to offer people two entry
> points to the store, one would set for US pricing, the other canadian.
>
> Checked out some messages in the group, and I have a UserTag which
> seems to do the trick, and it will display the correct price by
> itself -- but doesn't effect the actual price ic displays for the
> item? What am I missing?
>
> --- On my flypage I have the following (and the correct price is
> displayed)
>
> Pricing: [scratch whichCatalog] Dollars ([item-field caPrice])
> ([adjprice code="[item-code]" quantity="1" title="[item-field title]" ])
>
>
> --- In my catalog.cfg (please ignore the title stuff)
>
> CommonAdjust [adjprice]
>
> UserTag adjprice Interpolate
> UserTag adjprice Order code quantity title
> UserTag adjprice Routine <<EOR
> sub {
> my ($sku, $quantity, $title) = @_;
>
> $sku ||= $item->{code};
> $quantity ||= $item->{quantity};
> $title ||= $item->{title};
>
> my $price = $Tag->data( {
> table => 'products',
> field => 'caPrice',
> key => $sku,
> });
>
> # return $quantity*($price + $quantity * 5 * length($sku));
> return $quantity*$price;
> }
> EOR
>
> Thanks for any help!
>
How about
Autoload <<EOR
[perl arg="scratch config"]
if($Scratch->{mv_locale} =~ /en_US/) {
$Config->{PriceField} = 'price';
}
else {
$Config->{PriceField} = 'caPrice';
}
[/perl]
EOR
in your catalog.cfg (not tested) and you can let your code
([item-price], etc.) as it is?
Joachim
--
Hans-Joachim Leidinger | Dipl.-Phys.Ing. Entwicklung eCommerce
[leidinger@bpanet.de]
Black Point Arts Internet Solutions GmbH
http://www.bpanet.de