All MyCashflow Interface tags have a scope that determines where the tags can be used. Some tags can also set their own scope in the helper attribute.
A tag's scope determines the store theme's templates and tags in whose helper
attributes this tag can be used.
Scopes are defined in themes in two ways:
- Some templates have a predefined scope. For example, you can use product tags in the single product template.
- Some tags can set scopes of their
helper
attributes, which means that only tags allowed by the scope can be used as the attribute's value.
To check a tag's scope, refer to the Scope section on the tag's dedicated page. If the tag has no prescribed scope, it will be marked as global which means that it can be used anywhere. Also, the scopes of tags' helper
attributes are indicated on tags' pages.
Setting the scope of the helper
attribute
Some tags can set the scopes themselves, which means that it is possible to use only such tags as the tag's helper
attribute value that are allowed by the scope. An example of such a tag is {Category}
, the scope of which is a product category. Additionally, also a product can fall into the tag’s scope by using the product list tag.
The tag {Category}
itself does not require any scope and can be used globally.
The following example illustrates the scope set by the {Category}
tag:
{Category(
id: 3,
helper: {{
{CategoryName}
{CategoryDescription}
{CategoryProducts(
helper: {{
<h3>{ProductName}</h3>
{ProductPrices}
{ProductBuy}
}}
)}
}}
)}
The desired product category can be indicated in the id
attribute and the contents to be printed are defined in the helper
attribute. In the example, the name, description and all products belonging to the product category will be printed.
You may also want to define the product list's markup and contents. The helper
attribute will work properly also when nested in the {CategoryProducts}
tag. The scope of the list printed by the tag is product, which means that product tags can be used as values of the attribute.