[ic] Discounting and converting

Mike Heins interchange-users@interchange.redhat.com
Fri Aug 17 10:02:00 2001


Quoting Stefano Malagoli (s.malagoli@datacode.it):
> Hi all,
> I have two items in my basket, and the total is present in two different
> way.
> If no discount are present all it's ok, but if one of the two items is
> discounted (via [discount code="[item-code]"] $q * [scratch new_price]
> [/discount] )
> the total in my default currency is ok, but the total in the other currency
> (displayed via [setlocale eur_EUR][subtotal][setlocale it_IT]) are
> calculated using the price of the non-discounted items correctly converted
> and the price of the second discounted items not converted.
> 
> It is correct and I have to modify the discount tag ?

This is the way it works; but you would instead do:

[discount code="[item-code]" interpolate=1] 
	## Just in case PriceDivide is zero, which it shouldn't be
	my $divider = $Config->{PriceDivide} || 1;
	return $q * [scratch new_price] / $divider;
[/discount]

This is assuming that [scratch new_price] is in your base currency, i.e.
the one where PriceDivide is 1.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous