6.19. summary

This tag calculates column totals.

6.19.1. Summary

    [summary amount]
    [summary amount=n.nn other_named_attributes]

Positional parameters: The first line shows the usage with positional parameters (given in order). The second line shows usage with named parameters.

Parameters Description Default
amount Numerical value to be added to previous total none
Attributes Default
currency none
format none
hide none, no hiding
name ONLY0000, internal use only
reset none
total none
Invalidates cache No
Macro No
Has end tag No

Tag expansion example:

    [loop list="10 20 30.5"]
        [summary amount="[loop-code]" hide=1]
    [summary total=1 format="%.3f"]
    [summary total=1 currency=1]

ASP-like Perl call:

    $Tag->summary( { amount => 10.5,
                       hide => 1, } );

    $Tag->summary( { amount => 25,
                       name => mytotal,
                   currency => 1, } );

or similarly with positional parameters,

    $Tag->summary( 10.5, $attribute_hash_reference ); See Also

templates/components/cart, pages/ord/checkout.html for more examples.

6.19.2. Description

The summary tag provides you with an easy way to calculate and display totals. The display of the amounts is fully customizable. You can hide display, or you can show the amounts with the proper currency formatting according to the locale, or you can define your own formatting. Any number of summaries can be kept on a page. currency

The amount or total will be displayed according to the currency formatting of the current locale if this attribute is set to true (non blank or zero). format

You can choose any formatting of the amount you like. Just set the format attribute to the desired formatting string (%s, %.2f etc.). When both, currency and format attributes are set, the format attribute will take precedence. So it doesn't make much sense to set them both at the same time. hide

Will suppress the display of amount when set to true. name

You can calculate as many totals as you like on the same page. Just supply a different label for each summary. reset

Will erase the total(s) if set to true. Be careful tough. It will reset ALL totals when you have no name attribute supplied. If you have provided a label for the name attribute then it will only reset the total for that particular label. All others won't be touched. total

Will show the total instead of the amount if set to true.