Simple Server-Side Shopping Cart.


Instructions for CPG 1.4x

This is a server-side Java (.js) shopping cart script, often referred to as a 2nd party cart. This mod uses one of your image's custom description fields to assign different price options for different pictures (current default is the first field). The script serves as an interface between your on site and PayPal. Users only interact with your shopping page so there are no official, encrypted "PayPal button" for this mod. Everything you need is included in this module, you simply need to backup your displayimage.php and replace it with the displayimage.php file in this package.


FEATURES THAT THIS MOD OFFERS:



Review the various paypal options and edit/set them to your needs.

Edit the new displayimage.php to your specific needs and tastes. Should you decide to rename the files, make sure you change the appropriate references to these files in the installation steps above. Remember also that if you require different price options for different types of products, this mod uses one of your image's custom description fields to assign different price options for different pictures. The current default is the first field. Default entries are Standards, Squares, Panoramics, and a default for all others. If the script does not find any of these words in the first field, it defaults to the last price structure block in the if/else statement(See the "//  IF/Else Set Pricing Block" block in the file).

If you need to use a custom description field other than the first field, you will have to change the "$pricing_setup = $user1;" variable in orders.php to $user2, $user3, or $user4, as appropriate.

You can also change the entries in the user field to whatever you wish. Just be sure to change the IF/ELSE statements accordingly.
In displayimage.php search for
Set paypal ID and currency type
Set your paypal ID and currency, accordingly.
Above this you will see the list of variables that have been defined.

Just below that you will see: "$pricing_setup = $user1;".
Change $user1 to $user2, $user3, or $user4 if you are already using the first custom image description field for something else.

Just below that is the following " IF/Else Set Pricing Block "
if ($pricing_setup=="Panoramics"||$pricing_setup=="panoramics") //custom field entry is "Panoramics"
{
$Option1 = " Matted size: 10\" x 20\" (image size: 6\" x 16\") @35.00 ";
$Desc1 = "   10\" x 20\" @ $35.00 USD ( image size: 6\" x 16\") " ;
$Option2 = " Matted size: 14\" x 28\" (image size: 9\" x 23\") @95.00 ";
$Desc2 = " 14\" x 28\" @ $95.00 USD ( image size: 9\" x 23\") ";
$Option3 = " Matted size: 16\" x 32\" (image size: 11\" x 27\") @125.00 ";
$Desc3 = " 16\" x 32\" @ $125.00 USD ( image size: 11\" x 27\") ";
$Option4 = " Matted size: 18\" x 36\" (image size: 12\" x 30\") @135.00 ";
$Desc4 = " 18\" x 36\" @ $135.00 USD ( image size: 12\" x 30\")";
$Option5 = " Matted size: 20\" x 40\" (image size: 13\" x 33\") @150.00 ";
$Desc5 = " 20\" x 40\" @ $150.00 USD ( image size: 13\" x 33\")"; $Option6 = "";
$Desc6 = "";
$Option7 = "";
$Desc7 = "";
$Option8 = "";
$Desc8 = "";
$Option9 = "";
$Desc9 = "";
$Option10 = "";
$Desc10 = "";
}
else
// 11-20 for 2nd option or "Squares"
if ($pricing_setup=="Squares"||$pricing_setup=="squares") //custom field entry is "Squares"
{
$Option1 = " Matted size: 8\" x 8\" (image size: 6\" x 6\") @15.00 ";
$Desc1 = "   8\" x 8\" @ $15.00 USD ( image size: 6\" x 6\") " ;
$Option2 = " Matted size: 10\" x 10\" (image size: 8\" x 8\") @30.00 ";
$Desc2 = " 10\" x 10\" @ $30.00 USD ( image size: 8\" x 8\") ";
$Option3 = " Matted size: 12\" x 12\" (image size: 9\" x 9\") @40.00 ";
$Desc3 = " 12\" x 12\" @ $40.00 USD ( image size: 9\" x 9\") ";
$Option4 = " Matted size: 14\" x 14\" (image size: 11\" x 11\") @60.00 ";
$Desc4 = " 14\" x 14\" @ $60.00 USD ( image size: 11\" x 11\")";
$Option5 = " Matted size: 16\" x 16\" (image size: 12\" x 12\") @75.00 ";
$Desc5 = " 16\" x 16\" @ $75.00 USD ( image size: 12\" x 12\")";
$Option6 = " Matted size: 18\" x 18\" (image size: 13\" x 13\") @90.00 ";
$Desc6 = " 18\" x 18\" @ $90.00 USD ( image size: 13\" x 13\")";
$Option7 = "";
$Desc7 = "";
$Option8 = "";
$Desc8 = "";
$Option9 = "";
$Desc9 = "";
$Option10 = "";
$Desc10 = "";
}
else
// 21-30 for third option or "Standards and all else"
if ($pricing_setup=="Standards"||$pricing_setup=="standards"||$pricing_setup=="")
{
$Option1 = " Matted size: 8\" x 10\" (image size: 5\" x 7\") @15.00 ";
$Desc1 = "   8\" x 10\" @ $15.00 USD ( image size: 5\" x 7\") " ;
$Option2 = " Matted size: 11\" x 14\" (image size: 6\" x 9\") @30.00 ";
$Desc2 = " 11\" x 14\" @ $30.00 USD ( image size: 6\" x 9\") ";
$Option3 = " Matted size: 16\" x 20\" (image size: 11\" x 15\") @50.00 ";
$Desc3 = " 16\" x 20\" @ $50.00 USD ( image size: 11\" x 15\") ";
$Option4 = " Matted size: 18\" x 24\" (image size: 13\" x 19\") @75.00 ";
$Desc4 = " 18\" x 24\" @ $75.00 USD ( image size: 13\" x 19\")";
$Option5 = " ";
$Desc5 = " ";
$Option6 = " ";
$Desc6 = " ";
$Desc8 = " ";
$Option9 = " ";
$Desc9 = " ";
$Option10 = " ";
$Desc10 = " ";
}
else
// fall back when nothing matches, SAME AS STANDARDS.
{
$Option1 = " Matted size: 8\" x 10\" (image size: 5\" x 7\") @15.00 ";
$Desc1 = "   8\" x 10\" @ $15.00 USD ( image size: 5\" x 7\") " ;
$Option2 = " Matted size: 11\" x 14\" (image size: 6\" x 9\") @30.00 ";
$Desc2 = " 11\" x 14\" @ $30.00 USD ( image size: 6\" x 9\") ";
$Option3 = " Matted size: 16\" x 20\" (image size: 11\" x 15\") @50.00 ";
$Desc3 = " 16\" x 20\" @ $50.00 USD ( image size: 11\" x 15\") ";
$Option4 = " Matted size: 18\" x 24\" (image size: 13\" x 19\") @75.00 ";
$Desc4 = " 18\" x 24\" @ $75.00 USD ( image size: 13\" x 19\")";
$Option5 = " ";
$Desc5 = " ";
$Option6 = " ";
$Desc6 = " ";
$Desc8 = " ";
$Option9 = " ";
$Desc9 = " ";
$Option10 = " ";
$Desc10 = " ";
}
Each option field ($Option#) is paired with a corresponding description field ($Desc#). The $Option# field is what the script reads and posts to your paypal cart. The $Desc# field is what your customer sees in the dropdown lists. The \" is an 'escaped' expression for double quotes("), representing inches. You must use the escaped expressions for special characters in the Options fields for the script to work. &nbsp " is used to add extra spaces between words to space things out aesthetically. The @ character followed immediately by numbers is how the script reads prices to send to paypal. You can have as many Options as you want in your dropdown list. Just remember to pair them accordingly.

The IF/ELSE code above reads the custom image display field and if an entry matches, "Panoramics, Squares, or Standards" it will display the appropriate price group to the customer. If it does not find any matching word, it will display the last group of options. Which by default are the same as the "Standards" group. From Admin Mode in your CONFIG options, enter a name for the custom image description field of your choice. If you can't think of anything better, use "Available Editions" (If you only need one dropdown list of prices, don't bother with this step and just edit the last ELSE block for your needs).

Scrolling down the file, in the "< !--// Display image storyline-- > " block of text. Several of the defined variables are used to customize text for the picture being displayed.

Search for:
Start Form Block for purchase options
This is the user interface purchase < FORM > code block.
You will need to edit the text in this form for your particular needs.
These include:
Select Finished size and Medium
Select matted size
Select print type
Select print medium
Select Mat Color
Decorative Mat Overlay (Optional, Double Matting)
Gift Wrap (+$7.50) (Includes greeting card of picture)
You will probably want to edit the various "Select Type" dropdown list options as well.
Pay close attention to how % surcharges and + fixed value charges are handled in the value= options. The + or % sign is immediately followed by the value without a space between the sign and number. The left half of each entry is what is read into the cart. The right half is what your user will see.

Edit the rest of the file as you see fit. You can add more dropdown lists or remove any dropdown and/or radio buttons as necessary. Enjoy.