Price Modifiers Configurator FieldType
See also: item options dedicated tag. The dedicated tag does not care about field name, and will output all item options found in your channel entry, regardless of name. The syntax is a bit easier to understand, so we highly recommend skipping right on over to it instead.
See also: price modifiers overview
CartThrob's price modifiers configurator custom fieldtype is used to display options from configurable products. These modifiers can be no-cost options, or they can add cost to the product. For more information, please see this article on configuring price_modifiers.
Installation
- Go to the ExpressionEngine addons » fieldtypes settings
- Select this fieldtype
- Install
- Once installed, go to your products channel(s) field groups and add a new fieldtype
- Select this fieldtype and add it to the field group
Add a this fieldtype to your Products channel
Head to Admin > Channel Administration > Channel Fields to add this fieldtype to your Products channel, or create a separate channel for these products and add it to your CartThrob product channel settings.
Differences between this field type and the standard Price Modifiers fieldtype
The Price Modifiers Configurator fieldtype is similar to the standard price modifiers fieldtype, but it adds additional functionality
- you can add additional option groups dynamically,
- this field can add text fields dynamically in addition to the standard dropdown select fields
- Each new group and option you add will generate an inventory/sku line item that you can use to track inventory of a configurable item.
Creating item options
When creating an entry, this is what it looks like:
This is an example of what the customer might see when used with the item options dedicated tag.
Front end output generated by item_options dedicated tag
Front end output generated by the fieldtype syntax
This is what the customer will see when used with the syntax outlined below
When using in the template make sure you are using the correct short name of your price modifiers field.
For this example we're using price_modifier
as the name of the
custom field. Yours may be named differently.
Although the price_modifier
"tag" is really a standard channel custom
field, we're treating it like a tag here. You can output some basic
information about the structure and content of the price_modifier
field.
Table of Contents
Variables
YOUR_FIELD:label
The full name of the price modifier field.
{product_color:label}
YOUR_FIELD:total_results
The total number of options to choose from.
{product_color:total_results}
Variable Pairs
YOUR_FIELD
You can use your item_options
field as a variable pair to output your
item_options
data.
{product_color} {option_value} {option_name} {price} {/product_color}
Conditionals
{if first_row}
Checks to see if this is the first option
{product_color}{if first_row}<select name="item_options[product_color]">{/if}{/product_color}
{if last_row}
Checks to see if this is the last option
{product_color}{if last_row}</select>{/if}{/product_color}
Examples
{exp:channel:entries channel="shirts" }
{if product_color:total_results}
{product_color:label} has {product_color:total_results} options available
{product_color}
{if first_row}
<select name="item_options[product_color]">
{/if}
<option value="{option_value}">{option_name} $ {price}</option>
{if last_row}
</select>
{/if}
{/product_color}
<ul>
{product_color}
<li>{option_value} {option_name} {price}</li>
{/product_color}
</ul>
{/if}
{/exp:channel:entries}