For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

price

Returns price of a product, identified by its product code, as found in the ProductFiles table(s).

Summary

  • [price code]

Parameter Description Default
code The item code (SKU). None
base Look up the item in this table. ProductFiles
convert Convert the amount according to the PriceDivide value for the current locale. No
discount Check discount and apply. No
discount_space The discount space to use. None
space Alias for discount_space. None
display Display the currency identifier as a symbol, as plain text or not at all. symbol
locale Override the current locale for the currency format. None
noformat suppress currency formatting. No
quantity Price for a specific quantity. 1

Examples

Tag expansion example

[price 99-102]
$10.00

Perl example

$Tag->price({
     code => $code,
});

or similarly with positional parameters: 

$Tag->price($code, $attribute_hash_reference);

Description

Returns 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:

CommonAdjust  pricing:q2,q5,q10,q25, ;products:price, ==size:pricing

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:

Quantity Column used
2-4 q2
5-9 q5
10-24 q10
25 and up q25

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:

[price code=99-102 quantity=10 size=XL]

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:

code q2 q5 q10 q25 XL
99-102 10 9 8 7 0.50

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:

code description price size
99-102 T-Shirt 10.00 S=Small, M=Medium, L=Large*, XL=Extra Large

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.

Tag Returns
[price 99-102] $10.00
[price code="99-102"] $10.00
[price code="99-102" quantity=1] $10.00
[price code="99-102" noformat=1] 10
[price code="99-102" quantity=5] $9.00
[price code="99-102" quantity=5 size=XL] $9.50
[price code="99-102" size=XL] $10.50
[price code="99-102" size=XL noformat=1] 10.5

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:

Tags

[discount 99-102] $s * .9[/discount]

[price code="99-102"]
[price code="99-102" discount=1]
Results

$10.00
%9.00

Parameters

code

The product's item code (SKU).

base

Use the named table, instead of the ProductFiles table(s).

convert

If true then convert the amount according to the PriceDivide value for the current locale.

See the [currency] tag for a usage example.

discount

If true then check for, and apply, the appropriate product discount.

discount_space

display

The 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.

locale

This 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.

Note

Note

Setting this parameter causes the convert parameter to also be set, unless you specify "convert=0".

noformat

If true then suppress currency formatting from the value returned from this tag.  See the [currency] tag.

quantity

Specify 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.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Thursday 16 November 2006 at 10:33 AM (CST)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us