[ic] Read variable in [perl][/perl] tags
frank
frank at goldissue.com
Wed Dec 31 06:23:26 EST 2003
Danilo Ingami wrote:
> Hi list user,
> I've a simple problem (not for me of course). I need to calculate the
> insurance cost for a shipping.
> I use the weight method to calculate the amount of shipping and it
> works fine.
> For calculate the total cost of the order I need to apply a
> percentage, with at least a minimum cost, to the subtotal of the order.
> I think to do this with perl code in the checkout page, but I don't
> know the manner to read the value of the
> [subtotal], [salestax] and [shipping] ic tags within the
> [perl][/perl], and of cource how to get out the result from there.
> I had read a lot of documentation, but I don't find what I'm looking
> for. Can anyone point me in the right direction?
> Many thanks an happy new year to everyone.
> Danilo
>
Hi Danilo,
I didn't know the answer until two days ago where I had to display the
total cost on the receipt (which is inclusive of tax) but show what
proportion was actually tax.
<tr>
<td colspan=3>
</td>
<td>
TOTAL GST ON INVOICE
</td>
<td align=right>
[calc]
sub subtotalgst {
my($subtotal,$x) = @_;
$subtotalnumber=substr($subtotal,1,20);
$subtotalgst=$subtotalnumber*(1-0.909090909);
return '$'.sprintf("%.2f",$subtotalgst);
}
[/calc]
[calc]subtotalgst('[total-cost]')[/calc]
</td>
</tr>
I think the answer to your question is that the subroutine subtotalgst
uses the [total-cost] already in use on the receipt.
Thats a good idea by the way. I have included insurance in the shipping
calculation which is a modification of the ups_query tag.
I may actually display insurance separately if I can find a logical way,
Regards,
Frank Reitzenstein.
More information about the interchange-users
mailing list