UseModifier
Specify attributes that can be saved in the cart along with a line item.
Synopsis
|
UseModifier name [, names...]
|
The parameter is expected to be a comma-separated list of item
attribute names.
Scope
This directive is only available for use in the local
(catalog.cfg) configuration file.
It will not affect any other website in any way.
This directive will not work in the global
(interchange.cfg) configuration file.
Description
This directive is used to specify the attributes that can be saved in the
cart along with a line item.
|
Warning
Interchange reserves some item attribute names for internal use
and cannot be used as modifiers without the risk of significant
side-effects.
Reserved names include
"code",
"free",
"free_message",
"group",
"item",
"quantity" and
all words that start with "mv_" or "ic_".
|
Example
We first need to define UseModifier in the catalog.cfg
file as follows (and then restart Interchange):
Then we need to add the appropriate columns
(size and colour in this example)
to the products table.
For example:
| sku
|
description
|
price
|
size
|
colour
|
| 50595
|
Standard T-Shirt
|
15
|
S=Small, M=Medium, L=Large*, XL=Extra Large
|
red=Red, blue=Blue, white=White
|
| 50623
|
Winter Jacket
|
140
|
S=Small, M=Medium, L=Large, XL=Extra Large*, XXL=Extra Extra Large
|
blue=Blue, white=White, black=Black
|
| 50198
|
Long-sleeved Cotton Shirt
|
45
|
M=Medium*, L=Large
|
red=Red, blue=Blue, white=White, maroon=Maroon
|
You'll notice that the default option for each attribute is marked
with a "*" symbol.
Now all we need to display item size options is to call
[loop-accessories attrname]
on an Interchange page.
Let's create a sample attributes.html page:
<html>
<body>
<table cellpadding="5">
<tr>
<th>SKU</th>
<th>Description</th>
<th>Price</th>
<th>Modifiers</th>
</tr>
[loop search="ra=yes/fi=products"]
<tr>
<td>[loop-code]</td>
<td>
<a href="[area href='[loop-code]']">[loop-description]</a>
</a>
</td>
<td align="right">[loop-field price]</td>
<td>
[loop-accessories size]
[loop-accessories colour]
</td>
</tr>
[/loop]
</table>
</body>
</html>
|
See also