Waverider Systems

Perlshop 4 Inventory DBI Plugin Version 1.1

Contents


Overview

This plugin requires Perlshop 4.2.06 or later, and the Perlshop Database Interface.

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.


Installing the Inventory DBI Software

  1. Place the ps_plugin_inventory_dbi.pl file into the same web server directory as your perlshop.cgi file.
  2. Give the ps_plugin_inventory_dbi.pl file the same file permissions as your perlshop.cgi file.
  3. Add the Inventory DBI plugin to the plugin registration table in your ps.cfg file.

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'
    }
);

Required ps.cfg Inventory DBI Plugin Configuration Settings:

inventory_table
This setting specifies the name of the inventory table in your default PSDBI database. If you are using the database table design recommended by Waverider Systems, the name of this table will be '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'.

Optional ps.cfg Inventory DBI plugin configuration settings:

option1_column
option2_column
option3_column
These settings all work in the same way. If your inventory scheme requires both a part number and one or more option values to determine a unique stock item, then these columns will need to be used. Their values are the names of the option value columns in your inventory table. If you are using the database table design recommended by Waverider Systems, the name of these columns will be 'option1', 'option2', and 'option3'. These option column values are independant of each other. Only those required by your inventory system need to be included in the plugin definition.

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.


Using the Inventory DBI Plugin

Once added to the ps.cfg file, this plugin will automatically be used by Perlshop 4. No catalog page changes are required.