extra_options

Simple product options available for users to influence a SKU during purchase

Example

[%extra_options id:'[@sku@]'%]
    [%param *header%]
        <h4>Available Options</h4>
    [%/param%]
    [%param *number_option%]
        <label>[@name@]</label>
        <input name="extra[@count@]" id="productextra[@count@]" rel="[@SKU@]" value="">
    [%/param%]
    [%param *text_option%]
        <label>[@name@]</label>
        <textarea name="extra[@count@]" class="form-control" id="productextra[@count@]" rel="[@SKU@]" cols="20"></textarea>
    [%/param%]
    [%param *select_option%]
        <label>[@name@]</label>
        <select name="extra[@count@]" class="form-control" id="productextra[@count@]" rel="[@SKU@]">[@choices@]</select>
    [%/param%]
    [%param *choices%]
        <option type="text" class="form-control" value="[@option_id@]">
            [%nohtml%][@text@][%end nohtml%]
            [%if [@price@] != 0%]
                (+ [%FORMAT type:'currency'%][@price@][%END FORMAT%])
            [%/if%]
        </option>
    [%/param%]
    [%param *footer%]
        <input type="hidden" name="extras" value="[@total_options@]"/>
    [%/param%]
[%/extra_options%]

Usage

The extra options tag loads options loaded to a product that don't have inventoried options. By adding an extra option, lets say "Gift message" on the text_option type, this will accept user input for a single product on a single order. The sample code is how it appears in the default template set, and loads each option available for a product using extra products and repeats for each option of the same type.

If you'd like to show the user product options that do have inventory (Ie. Are their own SKU's in Neto), you'll want to use the variations system and its relative tags.

Different formatting for the same extra options type

Frequently you may need to apply specific formatting to different options that share the same type. For minor changes, you can always rely on the [@name@] attribute to make a class that will identify that block. However, for more advanced formatting changes you can use an if statement to format a unique block.

In our example, we have 2 text options, "Name" and "Message" and we want to introduce a text block specific to the message, therefore our code would look like this :

[%extra_options id:'[@sku@]'%]
    [%param *header%]
        <h4>Available Options</h4>
    [%/param%]
    [%param *text_option%]
        [%if [@name@] eq 'Message'%]
            <label>[@name@]</label>
            <p>Text block specific to the "Message" option</p>
            <textarea name="extra[@count@]" class="form-control" id="productextra[@count@]" rel="[@SKU@]" cols="20"></textarea>
        [%else%]
            <label>[@name@]</label>
            <textarea name="extra[@count@]" class="form-control" id="productextra[@count@]" rel="[@SKU@]" cols="20"></textarea>
        [%/if%]
    [%/param%]
    [%param *footer%]
        <input type="hidden" name="extras" value="[@total_options@]"/>
    [%/param%]
[%/extra_options%]

Parameters

Name Options Description
`id:''` String The SKU of the item you'd like to query for the extra options
`*header` HTML & b@se tags Renders a single usable space above the body
`*choices` HTML & b@se tags Field for collecting data from the user as defined in Neto with pre-determined options, shown as option form function
`*number_option` HTML & b@se tags Field for collecting an integer for the product option
`*text_option` HTML & b@se tags Field for collecting a string for the product option
`*select_option` HTML & b@se tags Field for collecting data from the user as defined in Neto with pre-determined options, shown as a select form function
`*footer` HTML & b@se tags Renders a single usable space below the body
`ifempty:''`, `*ifempty` HTML & b@se tags If the extra_options returns no results, it'll load this block instead

Data Tags (choices/number_option/text_option/select_option)

Name Product Field Example Description
`[@choices@]` `` Loops through the options for a **Selection Box**
`[@count@]` 0 An incremental count that runs each array. Critical component for tracking which extras to add to the SKU via the form.
`[@default@]` Default 1 Default option for **Selection Box**. **0** - no, **1** - yes
`[@max@]` Option Attribute (MAX) 100 Maximum value for **Integer** and **Decimal** fields
`[@min@]` Option Attribute (MIN) 10 Minimum value for **Integer** and **Decimal** fields
`[@multiplier@]` Option Attribute (MULTIPLIER) 10 Multiplier value for **Integer** fields
`[@name@]` Option Name Ribbon The option name
`[@option_id@]` 0 For the choices param, is the unique ID to identify which choice is parsed to the form<
`[@price@]` Additional Price +2.00 Additional cost for this option for **Selection Box** only
`[@text@]` Option Attribute Red Value for this option - **Selection Box** only
`[@total_options@]` 3 Total number of extra option fields for this product
Name Example Description
`[@total_options@]` 3 Total number of extra option fields for this product

Was this article useful?

Be notified when this page is updated. Optional.