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

You are not logged in

Powered by Interchange version 5.7.0

assign

Allows you to assign numeric values to preempt the calculation of one or more of the [handling], [salestax], [shipping] and [subtotal] tags.

The assignment is persistent within a user's session until you clear it, an assigned tag will return your value instead of calculating a value.

Summary

  • [assign type=value type=value ...]
  • [assign clear=1]

Parameter Description Default
clear Clears all pending 'assign' tag assignments. No
credit None
handling Assigns an override value for the [handling] tag. None
salestax Assigns an override value for the [salestax] tag. None
shipping Assigns an override value for the [shipping] tag. None
subtotal Assigns an override value for the [subtotal] tag. None

Examples

Perl example

$Tag->assign({
    shipping => 2.99,
});

or similarly with positional parameters: 

$Tag->assign($href, $arg, $attribute_hash_reference);

Description

An assigned tag will return your value rather than calculating its own until you clear the assignment.

The assignment is persistent for the duration of the user's session, unless you clear it, and only affects the current user.  You can clear all assignments using the clear parameter, or you can clear individual assignments by assigning an empty string (not zero) to the named type(s).

Warning

Warning

You cannot clear an assignment by specifying a zero value.  If you assign zero then a zero amount will be assigned, and later returned by the corresponding currency display tag.  If you want to clear an assignment then either use an empty string, such as shipping="", or use the clear parameter.

The following eliminates sales tax and sets shipping to 4.99 (regardless of weight and destination etc.):

[assign salestax=0 shipping=4.99]

This restores the usual sales tax calculator and eliminates handling charges: 

[assign salestax="" handling=0]

This restores the normal behaviour to the [shipping] and [handling] tags: 

[assign clear=1]

The assignment affects only the value returned by a tag.  Other behaviour, such as rounding and formatting for the local currency, will not be affected by the assignment;  the display tag will take care of any currency formatting that is required.

You cannot use this tag to override the total cost value.  The [total-cost] value will always be the sum of [handling], [salestax], [shipping] and [subtotal].

Warning

Warning

You will get an error in the error log, and the specified assignment type will be cleared, if you try to assign a value other than a number or an empty string.

Parameters

clear

Setting this to a true value clears all pending assignments (i.e. all assignable tags return to normal behaviour).

credit

handling

This option sets a total handling cost.

The [handling] tag will be inactive, despite your assignment, unless the [value mv_handling] variable is true (i.e. a non-zero, non-blank value).

salestax

This parameter sets an override for the sales tax cost.

shipping

This parameter sets an override for the total shipping cost.

The [value mv_shipmode] must be set true (i.e. a non-zero, non-blank value) in order for your assignment to [shipping] to have any effect in the [total-cost] calculation.

subtotal

This parameter sets an override for the item subtotal cost (the value of all items excluding tax, handling and shipping etc.).

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Sunday 23 July 2006 at 4:14 PM (CDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us