myshop-calculate:< expression >
Entity | Value |
---|---|
Attribute(s) | style |
Type | value |
Relation | productlist, moreinfo, orderprocess |
Sometimes it may be needed to show a calculated number in a template or orderprocess screen. The extension myshop-calculate can calculate and display a number for you. Need to format the number? Use myshop-calculate:format-number for this purpose.
Example
This example shows how to calculate the number of points granted for a basket row. In this example the column called ‘product_points’ is added as backoffice/xml field, as such it is available using the extra-[columnname] expression. The calculation calculates the number of points by using this column and multiply it with the quantity of the current basket row.
<tr class="myshp_basket_product" style="myshop-repeat:basket;">
<td class="myshp_basket_product_name">
<span style="myshop-value:product-id"></span>
</td>
<td class="myshp_basket_product_description">
<span style=”myshop-value:description;" ></span>
</td>
<td class="myshp_basket_product_quantity">
<span style="myshop-value:quantity;"></span>
(points <span style="myshop-calculate:{extra-product_points}*{ quantity };"></span>)
</td>
</tr>
See also
The following extensions may also be interesting if you plan to use this extension:
Post your comment on this topic.