[ic] $Tag->total_cost Giving Spurious Result?

James Turnbull james at scotwebshops.com
Tue Apr 19 06:19:26 EDT 2005

> What I am actually trying to do is get [total-cost] with two decimal 
> places only, [total-cost noformat=1] is returning about 6 decimal 
> places.

> it seems to be *sometimes* (50/50) not adding the shipping value. 
> [total-cost] always returns the correct total cost its just when using 
> it in perl.

I don't have an answer to the actual problem but as a workaround have 
you tried getting the total cost value first? Something like:

[tmp tc][total-cost noformat=1][/tmp]
[perl tables="products"]
	my $price = $Tag->scratch('tc');
	my $rounded = sprintf("%.2f",$price);
	$Tag->tmp('newtotal', $rounded);
	return "";

RESULT: [scratch newtotal]




James Turnbull           james at scotwebshops.com
Web & Database Developer, Scotweb Marketing Ltd
http://www.scotweb.co.uk     info at scotweb.co.uk
13a Albert Terrace, Edinburgh EH10 5EA

More information about the interchange-users mailing list