[ic] Can't get CommonAdjust to adjust price.

John Murtari interchange-users@icdevgroup.org
Thu Dec 5 11:45:01 2002


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!

-- 
                                          John
___________________________________________________________________
John Murtari                              Software Workshop Inc.
mrlist@thebook.com 315.695.1301(x-211)    "TheBook.Com" (TM)
http://www.thebook.com/