Name

AutoModifier — specify products table columns containing values for product attributes

SYNOPSIS

[name=] [table:]column [:key] ...

DESCRIPTION

The directive specifies names of the product attributes which should be automatically loaded from table columns. Table, column and key identifiers belonging to a single specification are separated by a colon (:), while multiple specifications are separated by whitespace.

In other words, when an item is added to the shopping cart using Interchange's routines, the attributes declared in AutoModifier will be set to the values of the fields in the products database.

This facility will often be employed in determining product price, discount, tax and shipping, and other custom attributes; these attributes will probably be used in custom Perl code that will scan the electronic cart contents and perform decisions. For example, by defining columns heavy and downloadable, you will be able to perform decisions based on $item->{heavy} and $item->{downloadable} (but there are more access methods, see the attribute glossary entry).

DIRECTIVE TYPE AND DEFAULT VALUE

Catalog directive

EXAMPLES

Example: Specifying AutoModifier

To set whether an item is defined as "heavy" and requires truck shipment, or is "downloadable", set:

AutoModifier heavy downloadable

Also make sure to have the heavy and downloadable columns defined in your products database.


Example: set attribute 'heavy' from table 'inventory'

AutoModifier inventory:heavy

Example: set attribute 'weighty' from table 'inventory', column 'heavy'

AutoModifier weighty=inventory:heavy

Example: set attribute 'heavy' from table 'inventory', with a different SKU

AutoModifier inventory:heavy:mv_sku

NOTES

This can useful when doing shipping calculations or in embedded Perl code that works on item attributes.

See attribute for a complete introduction to item attributes.

AVAILABILITY

AutoModifier is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: lib/Vend/Config.pm
Line 632

['AutoModifier',   '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

UseModifier(7ic)

DocBook! Interchange!