This is a client-side Java (.js) shopping cart script, often referred to as a 3rd party cart. The script serves as an interface between your on site Paypal pages and PayPal. Users only interact with your shopping page so there are no official, encrypted "PayPal button" for this mod. Only when the user is done shopping, will s/he send information to the PayPal site for his/her final checkout. This provides a very secure shopping environment for your users. Everything you need is included in this module, you simply need to edit the standard_mounts.php and/or custom_mounts.phppage to suit your needs.
You can preview this mod at my site: "Artists in Hawaii", or 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" in the URL located in the address bar of your browser with "standard_mount.php" or "custom_mount.php and click 'enter' or 'go'. Making it a permanent installation that works with any product or picture in your Coppermine gallery only requires a few lines of code to be added to files that reside in the coppermine folders. See installation directions at the bottom of this page.ecart1.gif < -- navbar button1
ecart2.gif < -- navbar button2
csecards.gif < -- credit card image for cart
cseprint.gif < -- printer icon for cart
cseset.js < -- admin controls for cart.
csecart.js < -- javascript to run cart.
csecart.php < -- client-side cart.
custom_mounts.php < -- user interface for custom mounts of pictures.
standard_mounts.php < -- user interface for standard mounts of pictures.
CS_Paypal_Instructions.html < -- this file
What we have here is a client-side cart that temporarily exists on the user's machine, not on a remote server, which provides your users with a very secure shopping environment. As all purchase information is stored in a cookie, there are some limitations. Most notably, users can purchase any quantity of no more than 15 different items at one time. This limitation is due to the session cookies used to remember cart contents across your website's pages. If this limitation doesn't bother you, then you will find this to be an extremely professional, fast and efficient shopping cart with a host of features normally not available to you with server-side carts.
To take full advantage of what this cart has to offer you will need to learn the calls that drive this cart - these calls are detailed, below.
The cart reads through the various < FORM > elements of your site and extracts the necessary input data from the value, or text, fields of these elements. It then takes the user selected options to build the product description that ultimately ends up in the user's paypal order form. Notice how the cart works for the two differently formatted FORMs in the examples that come with this mod. It works with the select (one or multiple), checkbox, radio, or text FORM fields. View the source of your ecart.php to see how the interface works.
Making the right 'call':Here we start getting a little technical, so you may want to print the ecart.php and js scripts to make it easier to follow along.
1. The "SetAmtxx" and "SetCartxx" 'calls' use the variables (pc,a1,c1,a2,c2...). The first argument [pc] stands for product category (Only five are allowed, with the default value of zero). The "product category" here is for setting special shipping, tax, discount charges for different types of products. Next come [a1..a2..a3..etc.] which are the breakpoints, representing a set quantity or volume) and [c1..c2..c3..etc] which are amount($) or percent(%) changes that are to be applied at the various breakpoints, these are input as pairs of data following the product category (pc, a1, c1, and a2, c2, so on and so forth).
For example:
SetCartSH (0, 1, 2, 3, 4); (SetcartSH is used to set the quantity-based shipping parameters and sets the Product Category 0.)
1 to 2 items cost $2.00 to ship,
3 - items cost $4.00
And (in the 'call' definitions area we use the following call values -- see call section below to see how these call values follow the same pattern.),
pc = product category (class)
a = amount
c = charge
p = percent
q = quantity
w = weight
2. Item-based Calls: Any purchase option that is item-based only lasts for a single item purchase and as such must be reset for each such item in the cart (such as SetQtyD).
3. Coupon discounts based on a percentage of the total purchase have codes that are set in the cseset.js-list with the discount coded in a corresponding array, and they are tested with the call:
ChkCoup ();Codes from cseset.js:
In the above example, coupon code: "okay" provides a 5% cart-wide discount on all purchases; "aloha" provides a $10.00 discount on the total of all purchases; and "mahalo" provides a 15% discount on all purchases.
Use only ONE CORRESPONDING value to each coupon code!
Caution, the discount used in the coupon method works in addition to any item or cart-wide discounts you may have set up. This means that if you provide a quantity break based on a percentage, and also provided a coupon promotion based on a percentage, the total discount the customer would receive is the sum of both. The coupon entry form appears in the cart window (if turned on in your csecart.php with root.xx_coup = on), and once a successful coupon code entry is made, it disappears. [Acceptable coupon codes are in the cseset.js script. ]
5. Cart-wide tax can also be assigned by the region the goods are being ordered from. This item is assigned from a select where all of the relevant options are listed. For example, Canada, where purchase from a local province has a higher tax rate, while the rest of Canada is still subject to and has a lower tax rate. Modify You will need to modify csecart.php to change the values for your tax entries and
This drop down list has blank 'select' entry at the top and users select the appropriate tax from the list below it. This option may be included in a FORM on the cart display page. You ask the customer their location, and the appropriate tax is applied to all items. To use it, place this into the event handler of the select...
SetCartTX (this); // "this" gives access
Actually, it is best to use the method PayPal offers in their preferences because they can charge tax by country, so such a thing as one tax for England, and another for the rest of the EEC, is possible. But, for those who may need a different set of rules from paypal, this allows for a possibility of a more complex tax structure.
6. Amount/quantity/weight based shipping options that are user selected (ground, air, zone, etc). Here the customer may select from all the different options you supply. Each option has a different amount or quantity based table that you define. An order cannot be placed until the user selects his shipping option (unless shipping is deactivated, below).
7. Product categories. Here, items may be placed into categories or classes within which special options may be applied only to items in these classes or categories, such as discounts or shipping charges. The default category is zero or ("") null and everything normally is put into this category. If you have a special class of items, you place them into a specific category by calling SetPcat for that item in your HTML. Without that call, the default applies. Five (5) is the current limit. (This limit can be modified but a number too high can cause the cart to stop functioning as it fills up the cookie space. Generally speaking, a number under 30 will work but users may only be able to purchase any quantity of up to 10 products as a result. It all depends on how much information goes into the product description field. See the last paragraph on this page to modify this number, if you find it necessary.)
For example, if you had a special class of products that you only wanted to charge a one-time shipping fee of $1, no matter how many items within this class were ordered, you would do the following:
For each item in the special class you must set this call in every FORM where $pcat_code == (some number in a user field or other database field as a reference -- for this example, say 1). onsubmit event handler...
SetPcat ($pcat_code); // set class of item to 1 (special)
Then, in the set list at the beginning of the site (on the first page) you would include...
SetCartSH (1, 1, 1); // all products of category '1' items = $1 to ship.
Another example would be if you have a class of items that require NO shipping or handling charges, and gets no discounts (but everything else has these things apply to them, if ordered). In this case you would mark these items with the special call in the FORM event handler to set them to, say, class 2, but would include NO calls in the set tag all items that apply in your database for class 2 (using a custom image description field or another field which you create). You set them aside for special treatment, and then apply 'no special treatment' array, SetCartxx(2,0,0), - which means they are exempt from normal order charges, discounts, taxes, etc. based on whichever SetCartxx option you used.
What the default settings in csecart.js (lines 378 -406) should be :9. One of the advanced features of this cart is that thumbnail images of selected items can be displayed in the shopping cart, itself. This allows your users to keep on shopping, then look at their cart to confirm all their orders and make changes as necessary. It is turned on by default. Here's how it was done: This involves two steps...
10. You can display the shopping cart total quantity and/or total amount within a FORM anywhere on your page. It will even show if you have it set up to display in several places. There are just two requirements...
Qty in cart -
< input type="text" name="cqty" size="4" value="" />
Cart Total -
< input type="text" name="ctot" size="11" value="" />
<body onload="LoadTots (document.forms);">
All of the item-based calls except the ReadForm call may be executed anywhere within your page. However, they are best executed within a FORM because that structure gives you access to many different event handlers, and provides a natural mechanism for allowing the user to select options that may be available for an item.
The following rules are apply to all calls executed within a < FORM > code block < /FORM > that surrounds a single item for sale...
SetOpt1 ('User name and address', '');
ReadForm (this.form);
The example above sets the title for the field and allows the user to
input (or fill in) the value. < option value="item #7.5 @10.00" >;... This translated as a 7.5 oz item costing 10 dollars.
INSTALLATION NOTES.
The accompanying files are for the installation of the basic cart. Almost all of it may be customized, but it is probably best to start with the default setup, make sure that it works for you, before changing things.
This is a client-side cart that installs on your system (server hosting your site) - it does not reside on some other server, somewhere. The cookiesthat were mentioned earlier reside on your customer's system, not on your system - and you should never abuse their use.
LIMITATIONS. These are the limitations that need to be understood for both cart and data going to the PayPal.
if define('THEME_IS_XHTML10_TRANSITIONAL',1);Add the following:
// HTML template for intermediate image displayIf this section exists in your theme.php file, then, near the end of that block of code, where it reads:
<!-- END caption -->
</table>
if ($owner_link) {Just below that, add:
$ipinfo = '/ ';
} else {
$ipinfo = '';
}
}
$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=standard_mounts.php?album=$album2&cat=$cat2&pos=$pos2>" . $lang_picinfo['StandardMount2'] . '';
$info[$lang_picinfo['CustomMount']] = "<a href=custom_mounts.php?album=$album2&cat=$cat2&pos=$pos2>" . $lang_picinfo['CustomMount2'] . '';
$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' =>'Standard Options',
'StandardMount2' =>'Click here to view our standard mount options.',
'CustomMount' =>'Custom Options',
'CustomMount2' =>'Click here to view our custom mount options.',
If you need to use a custom description field other than the first field, you will have to change the "$user1" variable in the: if ($user1=="Panoramics"||$user1=="panoramics") line of standard_mounts.php and custom_mounts.php to $user2, $user3, or $user4, as appropriate. (The same applies to the if ($user1=="Squares"||$user1=="squares") and if ($user1=="Standards"||$user1=="standards") lines of the same code block. Edit the if/else block as is appropriate to your needs, in order to set pricing. If the entry in the assigned description field does not match any of words, pricing will default to the last if/else options in that block of code.