2.48. options
Builds HTML widgets as defined in the options table for selecting options associated with a given product. This tag handles simple, matrix or modular options. See also the accessories tag.
Here is an illustrative example from the 'tools' sample data set of the foundation catalog:
=== [options code=os28005] --- <input type=hidden name=mv_item_option value="logo"> <SELECT NAME="mv_order_logo"> <OPTION VALUE="c">Construct Something <OPTION VALUE="y" SELECTED>Your Logo</SELECT><BR> <input type=hidden name=mv_item_option value="color"> <INPUT TYPE="radio" NAME="mv_order_color" VALUE="BLK" > Black <INPUT TYPE="radio" NAME="mv_order_color" VALUE="BEIGE" > Beige <INPUT TYPE="radio" NAME="mv_order_color" VALUE="WHITE" > White<BR> <input type=hidden name=mv_item_option value="bristle"> <SELECT NAME="mv_order_bristle"> <OPTION VALUE="synthetic">Synthetic <OPTION VALUE="camel">Camel Hair</SELECT> ===
2.48.1. Summary
Parameters: code
- code
- Product key (usually sku).
- No default
- table
- Table to use for option attributes.
- Default: 'options'
- td
- Results as table rows. For example, compare the following example from the 'tools' sample data set with the earlier example:
=== [options code=os28005 td=1] --- <td><input type=hidden name=mv_item_option value="logo"> <SELECT NAME="mv_order_logo"> <OPTION VALUE="c">Construct Something <OPTION VALUE="y" SELECTED>Your Logo</SELECT></td> <td><input type=hidden name=mv_item_option value="color"> <INPUT TYPE="radio" NAME="mv_order_color" VALUE="BLK" > Black <INPUT TYPE="radio" NAME="mv_order_color" VALUE="BEIGE" > Beige <INPUT TYPE="radio" NAME="mv_order_color" VALUE="WHITE" > White</td> <td><input type=hidden name=mv_item_option value="bristle"> <SELECT NAME="mv_order_bristle"> <OPTION VALUE="synthetic">Synthetic <OPTION VALUE="camel">Camel Hair</SELECT></td> ===
(Note that the output was reformatted to fit this page)
- price
- Default: False
- Boolean. If set and the options have prices, the HTML widget(s) will show the prices. This is like the price attribute of the accessories tag.
-
Note that the price_data setting comes from the 'price' column of the options table.
Technical note-- If your options table has different mappings, you can control this with $::Variable->{MV_OPTION_TABLE_MAP}
- label
- Shows labels for the options with the widgets.
- Default: False
The following example (using another item from the 'tools' data) illustrates the price and label attributes:
=== [options code=os28011 label=1 price=1] --- Handle<BR> <input type=hidden name=mv_item_option value="handle"> <SELECT NAME="mv_order_handle"> <OPTION VALUE="W">Wood handle <OPTION VALUE="E">Ebony handle ($20.00)</SELECT><BR> Blade material<BR> <input type=hidden name=mv_item_option value="blade"> <SELECT NAME="mv_order_blade"> <OPTION VALUE="P">Plastic blade ($-1.22) <OPTION VALUE="S" SELECTED>Steel blade <OPTION VALUE="T">Titanium blade ($100.00)</SELECT> ===
(again, the output has been reformatted to fit the page).
- bold
- Boldfaces the labels if the 'label' option is set.
- Default: False
- joiner
- The joiner for the widgets.
- Default: <BR>
Must pass named parameter interpolate=1 to cause interpolation.
Invalidates cache: no
Called Routine:
ASP-like Perl call:
$Tag->options( { code => VALUE, } ) OR $Tag->options($code, $ATTRHASH);