4.42. item-list

4.42.1. Summary

Parameters: name

The attribute hash reference is passed after the parameters but before the container text argument. This may mean that there are parameters not shown here.

Must pass named parameter interpolate=1 to cause interpolation.

This is a container tag, i.e. [item-list] FOO [/item-list]. Nesting: NO

Invalidates cache: YES

Called Routine:

ASP-like Perl call:

    NOTE: This would not usually be used with embedded Perl -- a better
    choice would normally be:

                 for(@$Items) { CODE }

    $Tag->item_list(
        {
         name => VALUE,
        },
        BODY
    )

 OR

    $Tag->item_list($name, $ATTRHASH, $BODY);

Attribute aliases

            cart ==> name
    [item-list name other_named_attributes]
Parameters Description Default
cart Alias for name DEFAULT_VALUE
name   DEFAULT_VALUE
Attributes Default
interpolate No
reparse Yes
Other_Characteristics  
Invalidates cache YES
Container tag Yes
Has Subtags No
Nests No

Tag expansion example:

    [item-list name]
---
    TODO: (tag result)

ASP-like Perl call:

   $Tag->item_list(  { name => VALUE_name
}, $body  );

or similarly with positional parameters,

    $Tag->item_list(name, $attribute_hash_reference, $body);

4.42.2. Description

Within any page, the [item-list cart*] element shows a list of all the items ordered by the customer so far. It works by repeating the source between [item-list] and [/item-list] once for each item ordered.

NOTE: The special tags that reference item within the list are not normal Interchange tags, do not take named attributes, and cannot be contained in an HTML tag (other than to substitute for one of its values or provide a conditional container). They are interpreted only inside their corresponding list container. Normal Interchange tags can be interspersed, though they will be interpreted after all of the list-specific tags.

Between the [item-list] markers the following elements will return information for the current item:

4.42.2.1. [if-data table column]

If the database field column in table table is non-blank, the following text up to the [/if-data] tag is substituted. This can be used to substitute IMG or other tags only if the corresponding source item is present. Also accepts an [else]else text[/else] pair for the opposite condition.

4.42.2.2. [if-data ! table column]

Reverses sense for [if-data].

4.42.2.3. [/if-data]

Terminates an [if-data table column] element.

4.42.2.4. [if-field fieldname]

If the products database field fieldname is non-blank, the following text up to the [/if-field] tag is substituted. If you have more than one products database table (see ProductFiles), it will check them in order until a matching key is found. This can be used to substitute IMG or other tags only if the corresponding source item is present. Also accepts an [else]else text[/else] pair for the opposite condition.

4.42.2.5. [if-field ! fieldname]

Reverses sense for [if-field].

4.42.2.6. [/if-field]

Terminates an [if-field fieldname] element.

4.42.2.7. [item-accessories attribute*, type*, field*, database*, name*]

Evaluates to the value of the Accessories database entry for the item. If passed any of the optional arguments, initiates special processing of item attributes based on entries in the product database.

4.42.2.8. [item-code]

Evaluates to the product code for the current item.

4.42.2.9. [item-data database fieldname]

Evaluates to the field name fieldname in the arbitrary database table database, for the current item.

4.42.2.10. [item-description]

Evaluates to the product description (from the products file) for the current item.

In support of OnFly, if the description field is not found in the database, the description setting in the shopping cart will be used instead.

4.42.2.11. [item-field fieldname]

Evaluates to the field name fieldname in the products database, for the current item. If the item is not found in the first of the ProductFiles, all will be searched in sequence.

4.42.2.12. [item-increment]

Evaluates to the number of the item in the match list. Used for numbering search matches or order items in the list.

4.42.2.13. [item-last]tags[/item-last]

Evaluates the output of the Interchange tags encased inside the tags, and if it evaluates to a numerical non-zero number (i.e. 1, 23, or -1) then the list iteration will terminate. If the evaluated number is negative, then the item itself will be skipped. If the evaluated number is positive, then the item itself will be shown but will be last on the list.

      [item-last][calc]
        return -1 if '[item-field weight]' eq '';
        return 1 if '[item-field weight]' < 1;
        return 0;
        [/calc][/item-last]

If this is contained in your [item-list] (or [search-list] or flypage) and the weight field is empty, then a numerical -1 will be output from the [calc][/calc] tags; the list will end and the item will not be shown. If the product's weight field is less than 1, a numerical 1 is output. The item will be shown, but will be the last item shown. (If it is an [item-list], any price for the item will still be added to the subtotal.)

4.42.2.14. [item-modifier attribute]

Evaluates to the modifier value of attribute for the current item.

4.42.2.15. [item-next]tags[/item_next]

Evaluates the output of the Interchange tags encased inside, and if it evaluates to a numerical non-zero number (i.e. 1, 23, or -1) then the item will be skipped with no output. Example:

      [item-next][calc][item-field weight] < 1[/calc][/item-next]

If this is contained in your [item-list] (or [search-list] or flypage) and the product's weight field is less than 1, then a numerical 1 will be output from the [calc][/calc] operation. The item will not be shown. (If it is an [item-list], any price for the item will still be added to the subtotal.)

4.42.2.16. [item-price n* noformat*]

Evaluates to the price for quantity n (from the products file) of the current item, with currency formatting. If the optional "noformat" is set, then currency formatting will not be applied.

4.42.2.17. [item-discount-price n* noformat*]

Evaluates to the discount price for quantity n (from the products file) of the current item, with currency formatting. If the optional "noformat" is set, then currency formatting will not be applied. Returns regular price if not discounted.

4.42.2.18. [item-discount]

Returns the difference between the regular price and the discounted price.

4.42.2.19. [item-discount_subtotal]

Inserts the discounted subtotal of the ordered items.

4.42.2.20. [item-quantity]

Evaluates to the quantity ordered for the current item.

4.42.2.21. [item-subtotal]

Evaluates to the subtotal (quantity * price) for the current item. Quantity price breaks are taken into account.

4.42.2.22. [item-modifier-name attribute]

Evaluates to the name to give an input box in which the customer can specify the modifier to the ordered item.

4.42.2.23. [quantity-name]

Evaluates to the name to give an input box in which the customer can enter the quantity to order.

4.42.2.24. name