Waverider Systems
Perlshop 4 Affiliate DBI Package Version 1.0
Contents
The Perlshop Plugin component of this package requires Perlshop 4.4.00 or later.
The Perlshop Office Plugin component of this package requires Perlshop Office version 2.3 or later.
Database tables used by this plugin:
All site hits from affiliates will be stored in database table named ps_affiliate_hits.
This table is expected to have the following form:
create table ps_affiliate_hits
(
aff_id varchar(40),
order_id varchar(40),
hit_date date,
hit_time time
)
Column aff_id contains the Affiliate ID number.
Column invoice_id contains the Invoice ID number.
Column hit_date contains the date that the shopper hit your web site.
Column hit_time contains the time that the shopper hit your web site.
All sales from affiliates will be stored in database table ps_affiliate_sales.
This table is expected to have the following form:
create table ps_affiliate_sales
(
aff_id varchar(40),
order_id varchar(40),
sale_date date,
sale_time time,
subtotal float
)
Column aff_id contains the Affiliate ID number.
Column invoice_id contains the Invoice ID number.
Column sale_date contains the date that the order was finalized.
Column sale_time contains the time that the order was finalized.
Column subtotal contains the item subtotal for the order.
Installing the Affiliate DBI Plugin:
- Place the PS_Affiliate_DBI.pm file into the same web server directory as your perlshop.cgi file.
- Give this file the same permissions as your perlshop.cgi file.
- Add the Affiliate plugin to the plugin registration table in your ps.cfg file.
Example plugin registration table before adding the Affiliate plugin:
%plugins =
(
# Calendar example plugin
'calendar' =>
{
'program' => 'ps_plugin_gencal.pl'
}
);
Example plugin registration table after adding the Affiliate plugin:
%plugins =
(
# Affiliate plugin
'affiliate_dbi' =>
{
'module' => 'PS_Affiliate_DBI.pm',
'event' => 'after_enter_shop|after_place_order|add_to_company_email',
'display' => 'no',
'hits_table' => 'ps_affiliate_hits',
'sales_table' => 'ps_affiliate_sales'
'send_email' => 'yes',
'cc_webmaster' => 'no',
'init' => 'no'
},
# Calendar example plugin
'calendar' =>
{
'program' => 'ps_plugin_gencal.pl'
}
);
Installing the Affiliate DBI Plugin Web Server Utility Program:
- Place the ps_affiliate_dbi_util.pl file into the same web server directory as your perlshop.cgi file.
This is not a CGI program, and is intended for web server command line use only.
- Give this file the same permissions as your perlshop.cgi file.
Once installed, this plugin will be used automatically by Perlshop. No catalog page modifications are required.
Optional features:
- By default, all affiliate hits information is stored in table ps_affiliate_hits.
If you want to change this, then you can alter the value of the hits_table
setting in the plugin information.
- By default, all affiliate sales information is stored in table ps_affiliate_sales.
If you want to change this, then you can alter the value of the sales_table
setting in the plugin information.
- By default, this plugin will send an email to the store email address each time a sale is made via an affiliate.
If you do not want to receive this email, then set the send_email setting
in the plugin configuration to 'no'.
- If you want a copy of the plugin email to be sent to the store webmaster email address, then set the
cc_webmaster setting in the plugin information to 'yes'.
- The database tables used by this plugin can be created through Perlshop Plugin Initialization (see below).
In order for this feature to work, you must set the init setting in the
plugin information to 'yes'.
Once the database tables have been created, you should set the init setting in the
plugin information to 'no'.
There are two ways to create the database tables used by this plugin.
Creating the database tables through Plugin Self-Initialization
The plugin database tables can be created using the Perlshop Plugin Initialization action:
http://www.yoururl.com/yourcgipath/perlshop.cgi?action=init_plugin&plugin=affiliate_dbi
Note: This action will only be allowed if the init setting in the
plugin information to 'yes'.
Once the database tables have been created, you should set the init setting in the
plugin information to 'no'.
Creating the database tables using the web server command line utility:
The database tables can be created from the web server command line using this command:
ps_affiliate_dbi_util.pl CREATEDB
Once created, these tables can be cleared from the web server command line using this command:
ps_affiliate_dbi_util.pl CLEARDB
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
Your Affiliates must link to your store using a URL of the following form:
http://www.yoururl.com/yourcgipath/perlshop.cgi?action=enter&thispage=somepage.html&order_id=!ORDERID!&affid=affiliate_id
Where:
- yoururl is replaced with the actual URL for your site
- yourcgipath is replaced by whatever your ISP has required of you
- somepage is replaced by the actual name of your store entry page file
- affiliate_id is replaced by the Affiliate ID value you've assigned to that affiliate
The Affiliate plugin will also work with QuickBuy mode. To do this, simply replace the enter action with quickbuy.
The Affiliate plugin may also be combined with the optional enteraction parameter.
- Place the PSO_Affiliate.pm file into the same web server directory as your psoffice.cgi file.
- Give this file the same permissions as your perlshop.cgi file.
- Add the Perlshop Office Affiliate plugin to the plugin registration table in your pso.cfg file.
%office_tool_plugins =
(
# Affiliate hit report
'affiliate_hit_report' =>
{
'label' => 'Affiliate Hit Report',
'module' => 'PSO_Affiliate.pm'
},
# Affiliate hit summary report
'affiliate_hit_summary_report' =>
{
'label' => 'Affiliate Hit Summary Report',
'module' => 'PSO_Affiliate.pm'
},
# Affiliate sales report
'affiliate_sales_report' =>
{
'label' => 'Affiliate Sales Report',
'module' => 'PSO_Affiliate.pm',
'selected' => 1
},
# Affiliate sales summary report
'affiliate_sales_summary_report' =>
{
'label' => 'Affiliate Sales Summary Report',
'module' => 'PSO_Affiliate.pm'
},
);
Once installed, these tools will be displayed in the Tools menu of Perlshop Office.
Affiliate Hit Report
This report displays all hits from all Affiliates. The data can be sorted by Sale Date, Affiliate ID, or Invoice ID.
Affiliate Hit Summary Report
This report displays the total number of hits for each affiliate. The data can be sorted by Affiliate ID, Total Hits, or Last Hit Time.
Affiliate Sales Report
This report displays all sales from all Affiliates. The data can be sorted by Sale Time, Affiliate ID, Invoice ID,
or Order Subtotal.
Affiliate Sales Summary Report
This report displays the total sales for all Affiliates. The data can be sorted by Affiliate ID, Total Sales,
Sales Subtotal, or Last Sale Date.