Credit card surcharge
Hi,
I'm attempting to add a credit card surcharge to my shopping cart. Starting off with editing cart_totals.tpl to have another row at the bottom showing the surcharge (in the same list as the sub total, discount, shipping etc).
I've run into problems immediately, though.
Starting simple, I just want to display the value of the surcharge on screen. I want to total the values of $cart.sub_total, $cart.discount and $cart.shipping_cost, and multiply it by 0.02 (to get the 2% surcharge value).
I can't get smarty to perform the addition/multiplication by following this approach:
{assign var="surcharge" value=($cart.sub_total+$cart.discount+$cart.shippi ng_cost)*0.02 }
and then using {$surcharge} to display the value on screen.
So I've tried it with php:
{php}echo(($cart.sub_total+$cart.discount+$cart.sh ipping_cost)*0.02);{/php}
And also
{php}echo(({$cart.sub_total}+{$cart.discount}+{$ca rt.shipping_cost})*0.02);{/php}
It's all a little bit confusing as I'm quite new to these smarty templates. If anyone has any ideas, I'd be very grateful.
Many thanks,
Richard
|