Name

price — calculate product price

ATTRIBUTES

Attribute Pos. Req. Default Description
code Yes Yes   product SKU.
quantity     1 quantity
discount     No Apply discount.
convert     No Convert the amount according to the PriceDivide value for the current locale.
noformat Yes No No Output plain number instead of formatting it according to the currency locale?
display     symbol Display currency as symbol, text or not at all?
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

The tag calculates the price for a specified product and returns it formatted.

The price tag will not apply discounts unless you supply the discount=1 parameter.

BEHAVIOR

This tag does not appear to be affected by, or affect, the rest of Interchange.

EXAMPLES

Example: Displaying price for item 1299, with quantity 1 resp. 10

[price 1299]
[price code=1299 quantity=10]

NOTES

AVAILABILITY

price is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: code/SystemTag/price.coretag
Lines: 31


# Copyright 2002-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: price.coretag,v 1.10 2007-03-30 23:40:49 pajamian Exp $

UserTag price               Order        code
UserTag price               addAttr
UserTag price               attrAlias    base mv_ib
UserTag price               attrAlias    space discount_space
UserTag price               PosNumber    1
UserTag price               Version      $Revision: 1.10 $
UserTag price               Routine      <<EOR
sub {
my ($code, $ref) = @_;
$ref->{code} ||= $code;

my $oldspace;
$oldspace = Vend::Interpolate::switch_discount_space($ref->{discount_space})
  if defined $ref->{discount_space};

my $amount = Vend::Data::item_price($ref);
$amount = discount_price($code, $amount, $ref->{quantity})
    if $ref->{discount};
Vend::Interpolate::switch_discount_space($oldspace) if defined $oldspace;
return currency( $amount, $ref->{noformat}, undef, $ref );
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

description(7ic), PriceField(7ic), field(7ic)

DocBook! Interchange!