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 edit the orders.phppage to suit your needs.
You can test drive this mod, yourself, without having to install it permanently. Simply copy the files into the appropriate coppermine folders and open an intermediate view of any file. Next, replace the "displayimage.php" part of the URL located in the address bar of your browser with "orders.php" while leaving the rest of the URL intact. Click 'enter' or 'go'.ecart1.gif < -- navbar button1
orders.php < -- user interface for standard mounts of pictures.
Simple_Sever-side_Paypal_Instructions.htm < -- this file
if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...');} //{THEMES}//Add the following:
$pid2 = (int)$HTTP_GET_VARS['pid'];Next search for:
$album2 = $HTTP_GET_VARS['album'];
$pos2 = (int)$HTTP_GET_VARS['pos'];
// HTML template for intermediate image displayNear the end of that block of code, where it reads:
<!-- END caption -->Add the following lines just after:
</table>
<table width="80%" align = "center" cellspacing="10px">NEXT, and this is very important, scroll down below this and cut the following line:
<td class="button" height="20" ><a href="orders.php?album=$album2&cat=$cat2&pos=$pos2"> <div align="center">Order this Print</div></a></td>
<td class="button" height="20" ><a href="displayimage.php?album=$album2&cat=$cat2&pos=$pos2"> <div align="center">Return to Browse Mode</div></a></td>
</table>
<!-- END img_desc -->NOW, paste it just above the entries you just added.
if ($owner_link) { $ipinfo = '/ '; } else { $ipinfo = ''; } }Just below that, add:
$pos2 = isset($_GET['pos']) ? (int)$_GET['pos'] : 0;Next, search for:
$cat2 = isset($_GET['cat']) ? (int)$_GET['cat'] : 0;
$album2 = isset($_GET['album']) ? $_GET['album'] : '';
$info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);Below that, add:
$info[$lang_picinfo['Title2']] = ($CURRENT_PIC_DATA['title']);Arrange these as you want them listed under your intermediate picture and save displayimage.php.
$info[$lang_picinfo['Description']] = ($CURRENT_PIC_DATA['caption']);
$info[$lang_picinfo['StandardMount']] = "<a href=orders.php?album=$album2&cat=$cat2&pos=$pos2>" . $lang_picinfo['StandardMount2'] . '';
$lang_picinfo = array(Paste the following in that section (Translate each descriptive string after => as necessary. Make sure each entry is surrounded by single quotes[']):
'Title2' =>'Picture Title',Save your language file.
'Description' =>'Description',
'StandardMount' =>'Purchase Options',
'StandardMount2' =>'Click here to view our purchase options.',
-- END ecard_button -->And add after that (I'm not a button designer, so you will probably want to design your own buttons instead of using the ones I have provided.):
<a href="{ECART1_TGT}" class="navmenu_pic" title="View Purchase Options"><img src="{LOCATION}images/ecart1.gif" border="0" align="middle" alt="View Purchase Options" /></a>Next, search for:
</td>
function theme_html_img_nav_menu()and insert the following just below the "$pid = $CURRENT_PIC_DATA['pid'];" statement.
$ecart1_tgt = "orders.php?album=$album&cat=$cat&pos=$pos";Next, look for:
'{ECARD_TITLE}' => $ecard_title,and insert just below that:
'{ECART1_TITLE}' => $ecart1_title,Save your theme.inc.php or theme.php 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.Set paypal ID and currency typeSet your paypal ID and currency, accordingly.
if ($pricing_setup=="Panoramics"||$pricing_setup=="panoramics") //custom field entry is "Panoramics"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.   " 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.
{
$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 = " ";
}
Start Form Block for purchase optionsThis is the user interface purchase < FORM > code block.
Select Finished size and MediumYou will probably want to edit the various "Select Type" dropdown list options as well.
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)