shopp('product.variations', 'options') @param string $object the object or object.tag combination, if object.tag is used, the tag parameter can be omitted @param string $tag the tag, can be hyphenated or not. Prefix with 'get' as shorthand for the return=true option @param mixed $options associative array, or url-style name=value pairs separated by ampersands (&). Each pair is passed to the theme api tag as an option. @returns void by default, HTML markup for variations with return option.
Generates HTML markup for product variants.
Using the mode option this tag can instead display variation selection controls.
In single mode it will display a single drop-down menu with each variation as a separate, selectable option. In multiple mode (the default used in the built-in product.php template file), this tag displays multiple menus for each variation option (the options that build to make a single variation) for a more natural option selection experience.
In multiple mode, a selection must be made from each menu in order to add the product to the cart. Additionally, the final price of the product cannot be determined until the last option is selected and as such, the price will only be displayed in the last menu.
- after_menu: No default value. Allows you to specify a string of characters or HTML markup to display after the the menu is displayed.
- before_menu: No default value. Allows you to specify a string of characters or HTML markup to display before the label (if enabled) and the menu are displayed.
- defaults: No default value. Allows you to specify a default option that is displayed as the initial selection for the menu.
- disabled: Default is show. Shows out-of-stock or disabled variations in the menu but makes them disabled and unable to be selected. When set to hide, excludes out-of-stock or disabled variations from the menu.
- format: Default is %l (%p). Set the format of the options shown in drop-down menus when
modeis set to
multiple. See Format Options below for available formatting tokens.
- label: Default is on. Displays a label with the name of the menu as entered in the product editor before the menu.
- required: Default is You must select the options for this item before you can add it to your shopping cart.. Specifies the warning error when attempting to add a product to the cart without selecting all of the necessary variation options.
- taxes: Default behavior depends on the base of operations. This setting can override the default. When set to true, includes the tax in the price(s) shown. When set to false, excludes tax from the price(s) displayed.
%p— shows the current variant price including available discounts.
%l— show the option label.
%s— show the stock amount of a product in inventory
%d— show the discount amount of an on sale variant.
%r— show the original price (the non-sale price) of the product variant.
%u— show the SKU for the product variant.
<?php shopp('product','variations'); ?>
Show multiple menus for complex variants with a label format that looks like
<?php shopp('product.variations', 'mode=multiple&format=%l: %p'); ?>
Show a single menu for all variant options with a label format that looks like
SKU1592 - Name: $10.00 (-$5.00) which shows the SKU, name, price and the discount amount in parentheses
<?php shopp('product.variations', 'mode=single&format=%u - %l: %p (-%d)'); ?>