Name

UseModifier — specify default attributes that can be attached to items

SYNOPSIS

modifier_name...

DESCRIPTION

Specify item attributes (or modifiers) that can be be attached to items.

Some of the names are reserved for use by Interchange, and you must not use them in modifier names. Namely, they include item, group, quantity, free, free_message, code and, of course, all mv_ variables.

You can see a quick list of those "reserved" names by entering the Interchange source tree and issuing grep -r 'item->{[^$]' * | less.

DIRECTIVE TYPE AND DEFAULT VALUE

Catalog directive

EXAMPLES

Example: Simple and standalone UseModifier example

We first need to define UseModifier in the catalog.cfg file (and restart Interchange afterwards):

UseModifier size,color

Then we need to add the appropriate columns — size and color — to the products database. Here's an example:

sku	description	price	size	color
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

(The entry signified with "*" will be understood as the default).

And now all we need to display item size options is call [accessories SKU size] on an Interchange page. Let's create a sample attributes.html page:

<html>
<body>

<table cellpadding="5">
  <tr>
    <th>Test #</th>
    <th>Description</th>
    <th>Price</th>
    <th>Modifiers</th>
  </tr>
  [loop search="ra=yes/fi=products"]
  <tr>
    <td>[loop-code]</td>
    <td>
      [page [loop-code]]
      [loop-field description]
      </a>
    </td>
    <td align="right">[loop-field price]</td>
    <td>
			[loop-accessories size]
   		[loop-accessories color]
		</td>
  </tr>
  [/loop]
</table>

</body>
</html>

I hope this completes a very simple but working example, and breaks the entry-barrier to the world of Interchange modifiers.


NOTES

For a complete introduction to item attributes, please see the attribute glossary entry.

AVAILABILITY

UseModifier is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: lib/Vend/Config.pm
Line 631

['UseModifier',     'array',            ''],

Source: lib/Vend/Config.pm
Line 3763 (context shows lines 3763-3783)

sub parse_array {
my($item,$settings) = @_;
return '' unless $settings;
my(@setting) = grep /\S/, split /[\s,]+/, $settings;

my $c;

if(defined $C) {
  $c = $C->{$item} || [];
}
else {
  no strict 'refs';
  $c = ${"Global::$item"} || [];
}

for (@setting) {
  check_legal($item, $_);
  push @{$c}, $_;
}
$c;
}

AUTHORS

Interchange Development Group

SEE ALSO

CommonAdjust(7ic), AutoModifier(7ic)

DocBook! Interchange!