Installation
Configuration
Payment Gateways
Setting Up Your Template
Preparing Your Shop
Displaying The Cart Total On Other Pages
Validation
Billing Variables
Localization
Shipping
Taxes
Options
Select Box Option:
Check Box Option:
Radio Button Option:
Text Box Option:
Extra Variable
Coupon System
Making PHPCart work on Windows NT/2000
Frequently Asked Questions
Copyright Notice
Appendix A
Adding Multiple Items Simultaneously
Looking for PHPCart 3.x documentation?
|
Introduction Installation
If you do not have telnet access to your server (e.g. if you are using Windows NT/2000), you must unpack the distribution with WinZip or similar program, and then upload each file by FTP (in BINARY mode). If you are using PHPCart on Linux, make sure the script has read and write access (777) to the You must also set write access to the following files in the admin folder: 1. Make a complete backup of your PHPCart installation (just to be safe). 2. Make absolutely sure you have backed up any files that you have customized (did you remember the template files?). 3. Upload all files and directories in the admin directory except the following: 4. Upload all other directories except the templates directory (check to see if there are any new template files and upload them). 5. Upload all files in the main directory (phpcart.php, etc) 6. If you have customized any files (such as the shipping module) copy your customized file back over the new version 7. Log into the admin control panel and select the Configuration menu choice. Verify all configuration options (some may be new) and save your configuration. 8. Run through a test order to make sure everything is working properly. Configuration Payment Gateways To activate a gateway, log into the admin control panel and select Gateway Settings from the menu. You can now activate and deactivate any of the gateways. You also need to set the Display Name for the gateway (only if activated). Once a gateway is activated you must click on the Configure link next to the gateway name and set the unique configuration options for that gateway. Once that is complete, your gateway is ready for use. Some gateways can be configured with certain return URLs depending on whether or not the payment was completed. If you wish to have the client return you can use the following URLs. · http://www.yourdomain.com/phpcart/phpcart.php?action=complete (send to this page if the payment was completed successfully) · http://www.yourdomain.com/phpcart/phpcart.php?action=canceled (send to this page if the client canceled the order) · http://www.yourdomain.com/phpcart/phpcart.php?action=declined (send to this page if the payment was declined) Remember, not all payment gateways support these return URLs. If you have problems setting up your template please post in the forum for assistance. It is not hard to set up the template and just takes a few minutes. Setting up your template is extremely easy. You only need to set up one template to make PHPCart look like the rest of your website. First, you will need an html file of your template. Just take one of your web pages and make a copy of it and call it template.php. Next, clean out all of the data in the template so you just have your header and footer. Now, just place the Template System Tag %%DATA%% right where you want the shopping cart to be displayed. Finally, upload your template.php file to the phpcart/templates/classic/ directory (overwriting the original template). If you would prefer to use the "generic" shopping cart then copy your template.php file into the phpcart/templates/generic/ directory and then log into the control panel and change your configuration option to the generic template (the default is the classic template). If your template and cart don't line up correctly, you may have removed too much html or not enough html. You should insert your %%DATA%% tag right in between the table cell tags (<td>%%DATA%%</td>) that previously held the main content of the page. If you have problems with this just post in our forum and we'll help you straighten this part out. That's it, your cart will now match the look of your site by using your own web page layout as the shopping cart layout. You can modify any of the existing templates that layout the rest of the shopping cart by modifying the files in the phpcart/templates/classic directory. You can see the full documentation on how to modify a template by viewing the PHPCart Template System (TS) documentation. Remember, you can start out small by just making a few adjustments to the templates until you get a better understanding of how it works. Just make a backup copy before you start. Preparing Your Shop Create your product web pages as usual. For each product on your web pages, create a link that surrounds the image or title of the product or create a form with hidden fields and an "Add To Cart" button. Whatever you have will work. In the link include the web-path to phpcart.php. You can use the Code Generator in the Control Panel to generate your product links. You can also create them via a scripting language or by hand. When creating them include the following variables:
As an example, consider the following link:
This is the minimum amount of information required to add a product to PHPCart. Here is another example of a link (broken into two lines)
In this case, the variables above have been assigned the following values:
Notice how each variable is separated by the ampersand (&). When your customers click on the link, the product will be added to their shopping cart automatically by PHPCart. If you have characters other than letters and numbers in the desription you will need to encode them. You can use the php function urlencode($descr) to replace these characters properly. This will replace spaces with a plus (+) and replace ampersands (&) with the html special character equivalent ( %26) which are the most common problems when passing product info. Always test your links on different machines with different browsers to make sure they all work correctly. Here is an example as a form (with a drop-down for each of the options and a drop-down for the quantity) <form name="anything"> In the example above we use a drop-down selection box to allow the customer to choose the quantity. You could also use a text box to allow the customer to select the quantity to order. If the quantity field is left blank then PHPCart will automatically assign a quantity of 1 to the product. Displaying The Cart Total On Other Pages 1. The page must have a ".php" extension or the php code will not work. 2. Edit the template file minicart.php to match your site layout 3. Include the minicart.php file exactly in the code where you want the cart total to appear. Example: That's it. You can review the Template System documentation to find out which variables are available to be displayed. Validation Billing Variables Localization You can translate the included language file to your own language if there is no translation. To do so, make a backup copy the file english.php in the /localization directory. Now, just edit the file and replace every string within double-quotes to the equivalents in your language. Save the file in the /localization directory. To activate your language, just make sure you have selected the English language in the configuration screen of the control panel. Shipping By Product: It is easy to add variable shipping/handling/postage fees by product when adding an item to your shopping basket. You can add a fee to each item by including the shipping variable. This amount will be added for each quantity. If the customer orders 5 of an item then this amount will be added 5 times. Use the shipping1 variable to set the shipping fee for the first item when the quantity field is set to higher than 1. An example would be setting shipping1=2.95 for product A. If the customer orders (on the same line) a quantity of 3 then the shipping for all three would still be 2.95. This is different from the "shipping" variable which would charge 8.85 for shipping 3 items. Use the shipping2 variable to set the shipping fee for each additional item after the first item. An example would be setting shipping1=2.95 and shipping2=1.95. If the customer orders (on the same line) a quantity of 3 then the shipping for all three items would be 6.85 (2.95 + 1.95 + 1.95). By Weight: You can assign a shipping fee based on the weight of your products. You must do two things to make this work. First, you must assign a weight variable to the product. Second, you must set up the Shipping By Weight table in the configuration screen. To assign the weight variable just add weight=5.25 to your product link. When you set up the Shipping By Weight table you must enter a list of weights and charges using the following format: weight:fee;weight:fee;weight:fee Enter a weight:fee pair (separated with a colon) and then add more weight:fee pairs (separated with a semi-colon). Make sure the first weight:fee has a weight of 0 if you want a charge to be set for orders between 0 and the first weight. Below is an example: 0:1.95;10:5.95:25:10.95:50:15.95 In the above example the following shipping charges for the order would be: Note that with the above scenario if the total weight value of all items in the shopping cart = 0 or there is no weight value then the amount charged for shipping will be 0 unless another shipping rule adds a shipping charge. By Order: You can assign shipping fees based on the order. You can assign a fee for each product or for the entire order. You can set a free shipping level. You can also set a shipping fee as a percentage of the total order. Finally, you can set a minimum or maximum shipping fee that will override all other shipping calculations. You can set these options in the configuration screen. Taxes In order to tax a customer that customer must be considered taxible. Taxibility is determined based on the state/region and country the customer is in. You must edit the States/Regions Tax Settings and/or the Country Tax Settings in the PHPCart control panel. You can add/modify states/regions and countries and then assign two tax rates two each state/region or country. If a product is assigned a taxrate id of 1 then any taxible customer will be charged the taxrate1 tax rate as assigned to that state/region or country. Instead of assigning a taxrateid to each product you can set a flag in the configuration of PHPCart that sets all products to be taxed if the customer is taxible. You can also set a flag in the configuration to determine if shipping should be taxed. If the customer is taxible and shipping is taxed, it is taxed at the taxrate1 tax rate. Options There are three different ways to send options to the cart: 1. use the format "option[]". This is the quickest and easiest to set up options. 2. use the format "optionX" (where X is a unique number for each option). This is required if you want to use radion buttons as your option. 3. use the format "optionX[]". This is required when the option is a text field (see below). When setting up options you will need to use a form to submit all the cart data (see the section above labeled Preparing Your Shop). Inside the form you will need to create some sort of choice for the customer to choose. You can present the optional choice to the user in several ways: 1. Select Box 2. Check Box 3. Radio Button 4. Text Box Select Box Option: <select name="option[]"> // optionally <select name="option1"> Or <select name="option1"> Check Box Option: <input type="checkbox" name="option[]" value="Gift Wrap:5.95"> Gift Wrap Or <input type="checkbox" name="option1" value="Gift Wrap:5.95"> Gift Wrap Radio Button Option: <input type="radio" name="option1" value="Color Blue"> Blue If you have a second set of options you would add them as follows: <input type="radio" name="option2" value="Smooth Finish"> Smooth Finish Text Box Option: <input type="text" name="option1[]"> Extra Variable extra1 When you modify a template to display one of the 3 extra variables you can wrap a TS Comment around the TS Tag. If the variable is empty, the comment and tag will be removed. You can find out more about how to implement the extra variables by referring to the Template System documentation. The default templates already use the extra1 variable as a way to pass in a return URL to the product detail page. This allows the customer to click on a link in the shopping cart to return back to the product detail page. If you do not include any information in the extra1 variable then the link will not be displayed. If you want to use the extra1 variable for something else, you can simply modify the cart.php file and remove the existing html code and add your own. Coupon System If a coupon gives a fixed amount discount and the subtotal is less than the discount then the subtotal becomes the discount amount. Example: Discount is $10 but the subtotal is $9. The customer only gets a $9 discount. The extra $1 will not go towards shipping or postage or tax. Add coupons in the admin section. You can not edit a coupon but you can easily delete and recreate a coupon if you make a mistake. Remember the percentage discount must be in whole numbers such as 35 (for 35%). Don't enter .35. Making PHPCart work on Windows NT/2000
If you do not have Exchange Server software you can use Smart Server and Internet Anywhere Mail Server to connect to the gateway of your ISPs SMTP server to send email.
· <A HREF="phpcart.php?action=clear">Clear Shopping Cart</A>
Copyright Notice |
Adding Multiple Items Simultaneously
PHPCart allows you to set up web pages that can submit multiple products to the shopping cart simultaneously. This could be used, for example, to take orders for a sandwich shop where the customer might order multiple sandwiches (with options), drinks and bags of chips all from the same page. Submitting multiple items to the cart requires the use of a form with the action variable pointing to phpcart-m.php (instead of phpcart.php). The format for each item is as follows:
<input type="checkbox" name="item_xxx" value="id|description|price|quantity|shipping|shipping1|shipping2|weight|taxid|extra1|extra2|extra3">
The name of the input type must increment for each item so the value of the name variable for the first item would be item_1 and the second item would be called item_2, etc. If you want to allow the customer to select the number of items to add then create a separate form field called qty_1, etc
Each of the multiple items can also have unlimited options. The naming convention for options is opt_xxx_yyy where xxx is the item number and yyy is the option number.
Copyright Carmos 2006