Waverider Systems

Perlshop 4 Ship by Email DBI Plugin Version 1.0

Contents


Overview

This plugin is intended for use by businesses that send their products to their customers via email (software packages, e-books, etc). For example, Waverider Systems uses this plugin to ship all software product packages.

The plugin executes in response to the after_place_order event. The plugin scans the order information and generates an additional email to the customer. This email contains a list of the various product files that were purchased. The product files themselves are carried along with the email as file attachments.

Requirements

This Perlshop Plugin requires Perlshop 4.4.00 or later.
The Perl MIME::Lite library module must be installed on the web server.

Product Files are Stored on the Web Server

All product files are stored on the web server in a specified directory (see below). It is recommended that these product files be in zip format.

Database Tables Used By This Plugin

This plugin refers to a web server database in order to gather the product files that are to be sent to a given customer. By default, the table referenced will be ps_products (this is the table used by most PSDBI users to store all product data). This default can be replaced by a custom setting when the plugin is installed (see below).


Installing the Ship by Email DBI Software

Installing the Ship by Email DBI Plugin:

  1. Place the PS_Ship_By_Email_DBI.pm file into the same web server directory as your perlshop.cgi file.
  2. Give this file the same permissions as your perlshop.cgi file.
  3. Add the Ship by Email DBI plugin to the plugin registration table in your ps.cfg file.

Example plugin registration table before adding the Ship by Email plugin:

%plugins =
(
    # Calendar example plugin
    'calendar'  => 
    {
        'program'    => 'ps_plugin_gencal.pl'
    }
);

Example plugin registration table after adding the Ship by Email plugin:

%plugins =
(
    # Ship product by email
    'ship_by_email_dbi' =>
    {
        'module'               =>    'PS_Ship_By_Email_DBI.pm',
        'event'                =>    'after_place_order',
        'display'              =>    'no',

        'payment_modes'        =>    ['Credit Card', 'PayPal'],

        'product_directory'    =>    '/home/yourdirectory/product_files',

        'product_table'        =>    'ps_products',
        'product_id_column'    =>    'code',
        'product_files_column' =>    'files',

        'cc_webmaster'         =>    'no'
    },

    # Calendar example plugin
    'calendar' => 
    {
        'program'   =>     'ps_plugin_gencal.pl'
    }
);

Using the Ship by Email DBI Plugin

Once installed, this plugin will be used automatically by Perlshop. No catalog page modifications are required.

Configurable Features:

  1. The plugin requires a setting named product_directory. The value of this setting is the complete web server file path to the directory that contains your product email files. It is recommended that these product files be in zip format.

  2. By default, this plugin will ship product by email in response to all orders. If want to restrict automatic shipment to orders that have been paid by specific modes (i.e. credit cards), you can use the payment_modes setting in the plugin definition. This setting is optional. If present, it is defined as a list of payment modes copied from the @accept_payment_by setting in your ps.cfg file. The example above restricts automatic email shipment to orders that have been paid by credit card or by PayPal.

  3. By default, the information in the product information table is looked up using the column name code. Information is looked up using the Perlshop Item ID number. If you want to use a different column name, then you can alter the value of the product_id_column setting in the plugin definition.

  4. By default, the list of files associated with a given Item ID is taken from a column named files in the product information table. If you want to use a different column name, then you can alter the value of the product_files_column setting in the plugin definition. The values stored in this column are expected to be simple file names (ex: product1.zip). If more than one file is to be sent for a given Item ID number, then they can be listed together separated by commas (ex: product2.zip,product3.zip).

  5. If you want a copy of the email generated by the plugin to be sent to the store webmaster email address, then set the cc_webmaster setting in the plugin definition to 'yes'.


Using the Plugin Self-Test

This plugin can execute a basic internal self-test. The results of this self-test are reported as a part of the Perlshop self-test action:
http://www.yoururl.com/yourcgipath/perlshop.cgi?action=selftest

Example Setup

Here is a typical SQL table definition that might be used by a generic PSDBI web site:
create table ps_products 
(
  code varchar(40) default '' not null,
  name varchar(40),
  description text,
  option1 varchar(20),
  option2 varchar(20),
  option3 varchar(20),
  price float(10,2),
  weight float(10,2),
  stock int(11),
  files varchar(80),
  PRIMARY KEY (code)
);
For this example, it is the code and files columns that are important. Here's an example of how this table might be set up:

codenamepricefiles
product1Our Blue Product1.00product1.zip
product2Our Red Product2.00product2.zip
package1Our Red/Blue Package2.50product1.zip,product2.zip