This plugin is intended for use by customers that already have the PSDBI package installed. The psdbi.cfg file is used by this plugin to connect to the default database.
After an order has been completed, Perlshop 4 will call this plugin. The plugin processes each item in the order file created by Perlshop, subtracting the number of that item sold from the number currently listed as in-stock in the database. After the order file has been fully processed, the plugin checks for out-of-stock or low-stock situations on the items in the order. If these exist, an inventory report on these items is emailed to the store business address.
Example plugin registration table before adding the Inventory plugin:
%plugins =
(
# Calendar example plugin
'calendar' =>
{
'program' => 'ps_plugin_gencal.pl'
}
);
Example plugin registration table before adding the Inventory plugin:
%plugins =
(
# Calendar example plugin
'calendar' =>
{
'program' => 'ps_plugin_gencal.pl'
},
# Inventory DBI plugin
'inventory_dbi' =>
{
'program' => 'ps_plugin_inventory_dbi.pl',
'event' => 'after_place_order',
# The following values are required. See the documenation below for details.
'inventory_table' => 'inventory',
'item_id_column' => 'code',
'stock_column' => 'stock',
# The following values are optional. See the documentation below for details.
'option1_column' => 'option1',
'option2_column' => 'option2',
'option3_column' => 'option3',
'low_inventory_column' => 'low_inventory'
}
);
item_id_column
This setting specifies the name of the column in the inventory table that stores
the unique part number for a given item. In a Perlshop catalog web page, this
is the value represented by the ITEM_ID tag. If you are using the database table
design recommended by Waverider Systems, the name of this table will be 'code'.
stock_column
This setting specifies the name of the column in the inventory table that stores
the number of items in stock for a given part number. If you are using the database
table design recommended by Waverider Systems, the name of this table will be 'stock'.
low_inventory_column
This setting contains the name of the optional low inventory warning level column of the
inventory table in your database. If this column does not exist, low-level inventory warning
reports will not be generated. If this column does exist, its value will be used to determine
when a low-inventory situation has occured. For example, if this column value is set to 4,
a low-stock message for that item will be included in the email sent to the store business
email address. This feature may be disabled for specific items by setting the
'low_inventory_column' value for that item to -1.
The recommended name for this column is 'low_inventory'.
If you wish to add a 'low_inventory' column to an existing inventory table, the following
SQL command may be used:
ALTER TABLE inventory ADD COLUMN low_inventory int
If you then wish to provide an initial default value to all of the rows of this new column,
the following SQL command may be used:
UPDATE inventory SET low_inventory = -1
Be sure to study the documentation for your database prior to attemping to use these commands.