![]() |
| > Home > Documentation > Latest documentation > Interchange tags > price |
|
priceReturns price of a product, identified by its product code, as found in the ProductFiles table(s). Summary
ExamplesTag expansion example
Perl example
or similarly with positional parameters:
DescriptionReturns the price of the product, identified by its unique code, as found in the ProductFiles table(s). If there is more than one products table defined, they will be searched in order unless constrained by the optional base parameter. Interchange maintains a price in its database for every product. The price column is the one required field in the ProductFiles tables, as it is necessary for the price routines. Quantity price breaks are configured by means of the CommonAdjust directive. There are a number of CommonAdjust recipes which can be used. The example in the Standard demo calls for a separate pricing table. Take the following example:
The above says to check quantity, find the applicable column in the pricing table and apply it to adjust the price. In this case, it would be:
What happens if quantity is one? It falls back to the price that is in the ProductFiles table. After that, if there is a size attribute for the product, the column in the pricing table, corresponding to that column, is checked for additions or subtractions (or even percentage changes). If you use this tag in the demo:
the price will be set according to the q10 column, adjusted by what is in the XL column. The row, of course, is "99-102". Take the following row in the pricing table:
The above would yield 8.50 for the per-item price, because the quantity of 10 in the q10 column sets the per-item price to 8, with 0.50 added for extra large (XL). Following are several examples based on the above entry as well as this the entry in the products table:
The following examples assume an en_US locale with 2 decimal places, use of commas to separate thousands in the value and a dollar sign ($) as the currency symbol.
Product discounts for specific products, all products, or the entire order can be configured with the discount tag. Discounts are applied on a per-user basis, and you can gate the discount based on membership in a club or other arbitrary means. Adding [discount 99-102] $s * .9[/discount] deducts 10% from the price at checkout, but the [price] tag will not show that unless you add the discount=1 parameter, as follows:
ParameterscodeThe product's item code (SKU). baseUse the named table, instead of the ProductFiles table(s). convertIf true then convert the amount according to the PriceDivide value for the current locale. See the [currency] tag for a usage example. discountIf true then check for, and apply, the appropriate product discount. discount_spacedisplayThe currency identifier will usually be displayed as a symbol (i.e. "£" or "$" etc.). If this parameter is set to "text" then the currency identifier will be displayed as plain text (i.e. "GBP" or "USD" etc.), depending upon the locale settings. If this parameter is set to "none" then the currency identifier will not be displayed at all. See the [currency] tag. localeThis parameter allows you to override the current locale that would be used to format the result and provide the exchange rate. See the [currency] tag.
noformatIf true then suppress currency formatting from the value returned from this tag. See the [currency] tag. quantitySpecify quantity to use when calculating the price. The price may be affected by your CommonAdjust settings when a quantity is specified. See the Price maintenance with CommonAdjust page for more information.
|
| Home | Legal nonsense | Privacy policy | Contact us |