The content printed by the majority of MyCashflow Interface tags can be formatted by modifying the value of the helper attribute. This article provides essential information about using the helper attribute.

Do not confuse the helper attribute with the {Helper} tag, which works according to the same principles.

The helper attribute is often used to format different lists. However, some non-list tags also have the helper attribute, e.g. {CheckoutShippingMethod} that prints the information about the shipping method chosen for the order.

The helper attribute is one of the most important tools when designing a MyCashflow theme. E.g. creating product lists and navigation can be extremely difficult unless the helper attribute is used for formatting.

Allowed values

The helper attribute is given as its value the content and markup that the tag is supposed to produce. Some tags have default output used when no value is set for the helper attribute. Some tags, however, will not produce any output without the content specified in the helper attribute.

The value of the helper attribute can take the form of either 1) direct HTML/Interface markup or 2) a reference to a file that contains markup to be produced.

Syntax

The syntax and allowed values of the helper attribute differ somewhat from the general syntax of tags.

If the attribute is to be assigned Interface markup as its value, the value must be placed within double curly brackets {{ ... }}:

{Products(
    category: 1,
    helper: {{
        {ProductName}
    }}
)}

Additionally, the attribute can be assigned a file reference as its value. To do so, the location of the selected file in relation to the theme root directory must be indicated as the attribute's value:

{Products(
    category: 1,
    helper: 'helpers/3-col-list-product'
)}

Scope in the helper attribute

Often tags that use the helper attribute set a scope inside the attribute that is different from the scope in which the tag itself is allowed. In this way, it is possible e.g. to produce contents in the product category scope that normally would require the product scope.

E.g. the product list {CategoryProducts} is often used on the product category page and the list elements should be able to contain product tags. Because the helper attribute of the product list tag has product set as its scope, the list's desired contents and markup can be produced by setting the value of the attribute in the following way:

{CategoryProducts(
    before: '<ul>', 
    helper: {{
        <li>
            <a href="{ProductURL}">
                {ProductListImage(
                    link: false
                )}
                <h3>{ProductName}</h3>
            </a>
            {ProductPrice}
        </li>
    }},
    after: '</ul>'
)}

If you use a file reference as the value of the helper attribute, you can use in the referenced file the same markup that could be used as a direct value of the helper attribute.

The purpose of this article was to provide all the necessary basic information about the helper attribute's behavior and usage. In case of any questions, contact MyCashflow customer service.