The MySQL Module

Description

The MySQL module allows you to have over 1000 items in your product database. You are limited in size of the database only by the amount of diskspace you have and the CPU speed of your server. The MySQL module greatly speeds up product lookups and the checkout process. This is done by storing the product data in a indexed MySQL database table. Everytime you change the product database textfile you will have to run the "load_db.cgi" script to populate the database with the new product database.

The MySQL module also allows customers to save their contact information in the MySQL database. The customers can login using their email address and a password and the email form will be automatically populated with their current contact information. They can update their contact information by checking a checkbox on the orderform telling the MySQL module to update their information. If the customer forgets their password the MySQL module will email the customer their current password.

Installation

The MySQL module consists of three files called shop_mysql.pl, create.cgi, and load_db.cgi. It works on servers running UNIX that have MySQL and the PERL DBI module installed.

To install it you must put it in your cgi directory along with the shop.pl file. The configure the MySQL portion of the shop.cfg file to have the correct MySQL database login information.

You should then run the create.cgi script. This script will create the database tables needed for the MySQL module. After you run create.cgi please chmod it to 000 so no one can run the create.cgi script again. Then you should run the load_db.cgi script to load the product database textfile into the MySQL database. Run load_db.cgi everytime you change the product database textfile.

Saving Customer Contact Information

To allow customers to save their contact information follow these steps:
  1. Change all links to the checkout/email form to have show_customer_data=1 at the end of the URL.
  2. Add a form to the email form like this:
    <form action=/cgi-bin/shop.pl/SID=PUT_SID_HERE/show_customer_data=1/page=email.html/login=1 method=POST>
    Email address<br>
    <input type="text" name="email" value="" size="40">
    <br><br>          
    Password<br>
    <input type="password" name="password" value="" size="8" maxlength=8><br>
    <input type=submit value="Login">
    </form>
    
  3. Add a checkbox to the email form with a name of create_new_account and a value of Y By this checkbox put something like this: "Check this box to create a new account or update your current account when you checkout"
  4. Use the form tokens detailed on the "Web Page Creation" page to make the cart insert the customer's data into the email form. Partial example:
    Your email address<br>
    <input type="text" name="email" value="PUT_EMAIL_HERE" size="40">
    <br><br>          
    Password<br>
     <input type="password" name="password" value="PUT_PASSWORD_HERE" size="8" maxlength=8>
    <p>Your name<br>
    <input type="text" value="PUT_NAME_HERE" name="name" size="40">
    </p>
    <p>
    Your phone number:<br>
    <input type="text" name="phone" value="PUT_PHONE_HERE" size="40">
    </p>
    
[an error occurred while processing this directive]