Marty.net
cpshop installation guide

http://www.marty.net/go2/site/view/marty/108
Click here for a printable version of these instructions.

cpshop is incredibly easy to install. If you've installed perl scripts in the past, then you can probably guess how this works. If you prefer a little hand-holding, however, then here you are. Every step of the way is covered in exhaustive, even unnecessary detail.

Keep in mind that I really do cover every ridiculous detail in here, so if you know what you're doing feel free to skim.

Summary:

Step One: Make Sure You've Got Everything

This is what you'll need to have to set up cpshop:

Step Two: Create Your Template

Here's the most creative part of the process. Essentially, make an HTML page with special tags marking where certain content will go -- your cpshop distribution should have come with a demo file called cptemplate.html, which you can edit if you prefer. I'll assume here you call the template "cptemplate.html", though you can really call it anything you want.

List of tags:

<html>
<head>
<title><[title]></title>
<meta type=keywords value="<[keywords]>">
<meta type=description value="<[description]>">
</head>
...
The full list of template tags is maintained here.

Here is an example of a very typical (and very boring) looking template. Feel free to cut-and-paste it, if you'd like to use it as a starting point:

<html>

<head>
<title><[title]></title>
</head>

<style type="text/css">
<!--
body {
font-family:arial,helvetica,sans-serif;
font-size:10pt;
}
-->
</style>

<body bgcolor="#DDDDAA">
<center>

<table width=600 cellpadding=0 cellspacing=0>

<tr>
<td bgcolor="#DDDDDD" align=right>
<font face="century gothic" size=6>
<i><b>my store</b></i>
</font>
</td>
</tr>

<tr>
<td>
<spacer height=3 width=1>
</td>
</tr>

<tr>
<td align=center bgcolor="#FFFFFF">
<table cellpadding=10 width=100%>
<tr>
<td align=center>
<[content]>
</td>
</tr>
</table>
</td>
</tr>

</table>

</center>
</body>

</html>

Some hints in creating your template:

Step Three: Rename cpshop.cgi and cpshop.cgi.config/cpshop.cgi.images (optional)

If you want to, you can rename cpshop.cgi to something else, like "cpshop.pl", "cpshop", or "mystore".

If you do rename cpshop.cgi, you also have to rename cpshop.cgi.config and cpshop.cgi.images to match. So if you rename cpshop.cgi to store.pl, then rename cpshop.cgi.config to store.pl.config, and cpshop.cgi.images to store.pl.images.

For the purposes of these instructions, I'll assume the name of the main script is still cpshop.cgi, the config file is still cpshop.cgi.config, and the image swap file is still cpshop.cgi.images.

Step Four: Set Up Your Dummy Store

No, you're not selling dummies. :) The Dummy Store serves two purposes: to tell cpshop which store to use as the base store for the cart and checkout process, and to allow you to redirect your visitors to cpshop from your shop.

If you don't have a premium shop, then do nothing for this step. Later on, however, I recommend you use the default entry (cpdefault) in the "Dummy Store ID" field in cpadmin, which will give your cart a plain white appearance (which is better than the heavily-branded CafePress look-and-feel).

If you do have a premium shop, and you're just planning on using cpshop for that shop, then I generally recommend you just enter that premium shop ID into the "Dummy Store ID" field in cpadmin (which you'll do when you're setting program options in step 8). However, if you'd also like visitors to be automatically bounced from your CafePress store to your cpshop store, then you should follow these instructions:

  1. Login to CafePress.
  2. Find your store in the list of stores, and click the "Customize" link next to it.
  3. Scroll down to the bottom of the customization page, and in the "Store Description" box, enter this code, changing the URL to the correct final address you plan to use for cpshop.cgi:

    <script src="http://www.mysite.com/cgi-bin/store/cpshop.cgi?js"></script>

    Then press the submit button to save your changes.

Step Five: Set The Admin Password

Open cpadmin.cgi in your text editor (once again, like Notepad), and change the password to something you can remember, but most people wouldn't think of. The password is located near the top of the script, between the quotes: $password = "mypass"

Later on, when you access the admin screen, you'll use this password to login. So don't forget it.

Step Six: Upload The Scripts

(Before you upload, make sure the first line in both cpshop.cgi and cpadmin.cgi points to the correct location of perl on your server. If you're not sure where it is [usually #!/usr/bin/perl or #!/usr/local/bin/perl] then try typing which perl from the telnet command line, or ask your system administrator.)

Using your FTP client, upload the script files to the server, along with any templates you've created, placing them in your cgi-bin directory (they can be in a sub-directory, like /cgi-bin/store/). Please note:

Step Seven: Create Special Sub-Directories

After setting up these directories, cpshop can cache CafePress' pages, speeding up loading time for your visitors, decrease server load for both you and CafePress, and add logging capabilities to your store.

  1. In the same directory as your three scripts, create three new sub-directories called "cpcache", "cplogs", and "cpbackup".
  2. Make both directories world-readable and world-executable (chmod 777 cpcache cplogs cpbackup).
Easy, ain't it?

Note: Starting with version 2.0rc12, cpshop supports Output Caching, which speeds up program output even more, decreasing CPU usage dramatically. It does so at the cost of disk space, however, so the functionality is optional but highly recommended. To enable Output Caching, you should create a fourth directory called "cpoutput" and also chmod it to 777.

Note 2: Starting with version 2.3, cpshop supports Hooks, which allow you to enter custom HTML that only appears on certain pages. If you want to use hooks, you'll want to create another directory called "cphooks", and then go read up on using cpshop hooks.

Step Eight: Set Program Options

Load cpadmin.cgi from the browser. For example, if your cpshop.cgi file is located here:

http://www.mysite.com/cgi-bin/store/cpshop.cgi
then cpadmin.cgi is likely located here:
http://www.mysite.com/cgi-bin/store/cpadmin.cgi

Enter your password on the password screen, and press the submit button to get the admin screen

If you've created multiple cpshops, you can use the dropdown box at the top of the admin screen to select the correct shop.

On the admin screen you can customize everything about your cpshop store. Everything is explained in place, so I won't bother doing it here. Just make sure you follow the instructions as closely as possible, and press the "save all changes" button when you're done.

Step Nine: Testing

Well, you've done everything you were supposed to do. Now try accessing the script from your browser. It should work like a charm.

(Of course, if it doesn't, then , and I'll try to help. But first make sure you uploaded the scripts in ASCII mode, and check your permissions to make sure they're all correct! You can also check out the FAQ and the message board.)