attribute

Attributes (sometimes also called modifiers, options or params) are various "sub-features" of a product. If you are selling t-shirts in different colors and sizes, color and size are ideal candidates for item attributes. Interchange allows attributes to be set for each ordered item. This allows a varying size, color, or any other modifier to be attached to an otherwise common part number.

See UseModifier for more information and concrete examples.

Besides setting modifier names in the config files (via the above UseModifier), you can also set them as scratch variables with mv_UseModifier. For example, the above modifiers would be set with [set mv_UseModifier]size color[/set]. This effectively allows you to have different product options for different or even same product SKUs. Those specified in mv_UseModifier at the time of order will be used (just be careful, because you cannot set it more than once on the same page).

[Note]Note

When choosing modifier names, do not use anything that begins with mv_ nor words like code, quantity or group; those variables have already been used up by Interchange itself.

You also need to make sure that no fields in your HTML forms have digits appended to their names, if their non-digit name part is equal to any used attribute. (This is because Interchange treats say, size0 and size1 as multiple size modifier values.)

In addition, setting SeparateItems or mv_separate_items places each ordered item on a separate line even if they have the same SKU, simplifying attribute handling.

The modifier value is accessed in the [item-list] loop with the [item-modifier attribute_name] tag, and form input fields are created with [modifier-name attribute]. This is similar to the way that quantity is handled, except that attributes can be "stacked" by setting multiple values in an input form (whereas there can be only one quantity field for each item).

When you want to provide a series of modifiers for an element, you can use the standard [loop] tag (such as [loop arg="item item item"]), or you can use the built-in PREFIX-accessories tag available with most Interchange list operations. The modifier value can then be used to select data from an arbitrary database for attribute selection and display.

Below is a fragment from a shopping basket display form which shows a selectable size with "sticky" setting. Note that the example can only work within the [item-list] tag.

  <select name="[modifier-name size]">
  <option [selected [modifier-name size] S]  /> S
  <option [selected [modifier-name size] M]  /> M
  <option [selected [modifier-name size] L]  /> L
  <option [selected [modifier-name size] XL] /> XL
  </select>

It could just as easily be done with a radio button group as well (when you combine them with the <checked> HTML tag).

In addition, Interchange would automatically generate the above select box if you called [accessories code size] or [item-accessories size].

DocBook! Interchange!