[ic] suggested changes to foundation

Kevin Walsh kevin at cursor.biz
Thu Aug 14 22:43:04 EDT 2003


Jon Jensen [jon at endpoint.com] wrote:
> Paul, could you explain why this doesn't work for you:
> 
> 	$record->{price} = $Tag->price($sku);
> 
> But this does:
> 
> 	$record->{price} = $Tag->price({ code => $sku });
> 
> Because the [price] tag expects the first parameter to be the code, and 
> the second to be a hashref. So it seems your fix is actually relying on 
> some unexpected behavior when the price tag calls item_price() and then 
> discount_price() with your anonymous hashref instead of a code scalar. I'm 
> not comfortable committing the change until I understand what's really 
> going on there.
> 
I think the problem is the code/SystemTag/price.coretag file, and could
be fixed with the following patch:

----------------------------------------------------------------------
*** price.coretag       12 Feb 2003 03:59:11 -0000      1.3
--- price.coretag       14 Aug 2003 20:41:01 -0000
***************
*** 5,10 ****
--- 5,12 ----
  UserTag price               Routine   <<EOR
  sub {
        my ($code, $ref) = @_;
+       $ref->{code} ||= $code;
+
        my $amount = Vend::Data::item_price($ref);
        $amount = discount_price($code, $amount, $ref->{quantity})
                        if $ref->{discount};
----------------------------------------------------------------------

I'll commit the change unless there's any objection.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/



More information about the interchange-users mailing list