4.71. shipping
Returns the cost of shipping the items in the cart via the shipping mode set with the mode parameter. See also the Shipping section of the Database documentation.
4.71.1. Summary
[shipping mode]
Parameters | Description | Default |
add | Adds the argument to add as data for a shipping.asc file (in $Vend::Cfg->{ScratchDir}/) and sets it. | DEFAULT_VALUE |
cart |
|
DEFAULT_VALUE |
carts | Alias for cart | DEFAULT_VALUE |
convert |
Applies the conversion (if any) set with the PriceDivide catalog configuration directive.
|
DEFAULT_VALUE |
default | Resets shipping mode to default of [value mv_shipmode] | DEFAULT_VALUE |
file | Filename to read shipping from (default is usual shipping database, e.g., shipping.asc) | DEFAULT_VALUE |
format |
Format for results with label attribute.
[shipping mode="FLAT" label=1 format="My Format Desc %D Price %F"] |
DEFAULT_VALUE |
handling |
Boolean-- use [value mv_handling] rather than [value mv_shipping] as first default for mode. Note that this attribute matters only if you do not specify the mode in the tag.
|
DEFAULT_VALUE |
hide | Suppresses output | DEFAULT_VALUE |
label |
By default, returns HTML <OPTION ...> widget for shipping mode(s), including description and cost. You can override the widget with the format attribute. Note that label overrides noformat.
[shipping label=1 mode=|[data table=country key='[default country US]' col=shipmodes]| ] |
DEFAULT_VALUE |
mode |
|
DEFAULT_VALUE |
modes | Alias for mode | DEFAULT_VALUE |
name | Alias for mode | DEFAULT_VALUE |
noformat |
Returns result as a number rather than a string formatted for the current locale's currency.
|
DEFAULT_VALUE |
reset_message | Boolean. Blanks the session's current shipping message (i.e., $Session->{ship_message}). | DEFAULT_VALUE |
reset_modes |
Clears list of modes in $Vend::Cfg->{Shipping_line}
|
DEFAULT_VALUE |
table |
|
DEFAULT_VALUE |
tables | Alias for table | DEFAULT_VALUE |
Attributes | Default |
interpolate (reparse) | No |
Other_Characteristics | |
Invalidates cache | YES |
Container tag | No |
Has Subtags | No |
Nests | Yes |
Tag expansion example:
[shipping mode] --- TODO: (tag result)
ASP-like Perl call:
$Tag->shipping( { mode => VALUE_mode }, $body );
or similarly with positional parameters,
$Tag->shipping(mode, $attribute_hash_reference, $body);
4.71.2. Description
This tag calculates the shipping cost for items in the current cart via the specified shipping mode (usually set in the mv_shipmode variable). See the Shipping section of the Database documentation for detail.
It also has options to build a selection widget (usually SELECT or RADIO types) with embedded cost data.
4.71.2.1. Rounding
Note that the tag rounds the calculated shipping cost to a locale-specific number of fractional digits (e.g., to the nearest penny, or 2 digits after the decimal point in the USA).
4.71.2.2. add
Adds the argument to add as data for a shipping.asc file (in $Vend::Cfg->{ScratchDir}/) and sets it.
4.71.2.3. cart
- Alias: carts Comma-delimited list of names of carts to calculate shipping cost for.
- Default: current cart
4.71.2.4. convert
Applies the conversion (if any) set with the PriceDivide catalog configuration directive.
- Default: True
4.71.2.5. default
Resets shipping mode to default of [value mv_shipmode]
4.71.2.6. file
Filename to read shipping from (default is usual shipping database, e.g., shipping.asc)
4.71.2.7. format
Format for results with label attribute.
- Default: '<OPTION VALUE="%M"%S>%D (%F)'
- For example,
[shipping mode="FLAT" label=1 format="My Format Desc %D Price %F"]
4.71.2.8. handling
Boolean-- use [value mv_handling] rather than [value mv_shipping] as first default for mode. Note that this attribute matters only if you do not specify the mode in the tag.
- Note that this is set by the [handling tag (which calls the shipping tag internally). You should probably use the handling tag rather than setting this directly.
- Default: False
4.71.2.9. hide
Suppresses output
4.71.2.10. label
By default, returns HTML <OPTION ...> widget for shipping mode(s), including description and cost. You can override the widget with the format attribute. Note that label overrides noformat.
- Here is an example from the foundation checkout.html page:
[shipping label=1 mode=|[data table=country key='[default country US]' col=shipmodes]| ]
4.71.2.11. mode
- Aliases: name, modes Whitespace, null or comma delimited list of modes for which to calculate shipping cost. See also mv_shipmode.
- Default: [value mv_handling] if handling=1 or [value mv_shipmode] or 'default'
4.71.2.12. noformat
Returns result as a number rather than a string formatted for the current locale's currency.
- Default: True
4.71.2.13. no_state
Bypasses the state lookup for [shipping widget=TYPE] and [shipping possible=1].
4.71.2.14. possible
Returns all possible modes for the selected country and state, based on the country and state tables.
Does a query to find the shipmodes column of the state based on the user value state, and/or the shipmodes column of the country based on the value country
NOTE: You can set the following, though most will use the Interchange defaults:
state_table state table for lookup (default "state") country_table country table for lookup (default "country") state_modes_field shipmodes field in state table (default "shipmodes") country_modes_field shipmodes field in country table (default "shipmodes") country_table country table for lookup (default "country") state_var state variable in user session (default "state") country_var country variable in user session (default "country") shipmode_var shipmode variable in user session (default "mv_shipmode")
4.71.2.15. reset_message
Boolean. Blanks the session's current shipping message (i.e., $Session->{ship_message}).
4.71.2.16. reset_modes
Clears list of modes in $Vend::Cfg->{Shipping_line}
- Default: False
4.71.2.17. resolve
Returns the one shipping mode to set as a default, based on the best information available. Usually selects the first in the list based on country or state.
4.71.2.18. table
- Alias: tables Whitespace-delimited list of tables containing shipping data required for perl or query calculations (e.g., in the 'PERL' field of your shipping database -- see Shipping). You must specify the tables to get past the Perl 'Safe.pm' protection. For example, you will get 'Safe' errors if you refer to an SQL table without specifying it here.
- Default: None
4.71.2.19. widget
Returns a pre-configured widget for shipping mode selection. Will select the modes from [shipping possible=1], but will also do shipping calculations to see if they are valid.
If there is no weight, zip, country, or other needed information, it will return "not enough information".
In other words, [shipping widget=select] might return to the page:
<select name="mv_shipmode"> <option value="upsg" SELECTED>UPS Ground ($4.20) <option value="upsb">UPS 2nd Day Air ($8.76) </select>