Vous êtes sur la page 1sur 44

Version 3.0.

Cartweaver 3 PHP End User License Agreement Single Developer License8 Section 1: Welcome to Cartweaver.......................................................... 10 The Cartweaver Shopping Cart ................................................................. 10 Easy Integration! ................................................................................... 10 Separating Form from Function................................................................. 11 Completely Customizable......................................................................... 11 The Administration Area .......................................................................... 11 The Cartweaver 3 Database ..................................................................... 11 The Cartweaver Customer Area ................................................................ 11 Conventions Used in this Manual............................................................... 12 Section 2: Definition of Terms................................................................. 14 Section 3: Directory Structure and Cart Flow Map.................................... 18 Directory Structure................................................................................. 18 Cart Flow Map........................................................................................ 18 Cart Flow Map........................................................................................ 19 Section 4: Cartweaver Step-By-Step ....................................................... 20 Preparation ........................................................................................... 20 Step 1: Install a PHP Application Server and Web Server ........................... 20 Step 2: Install the Cartweaver 3 PHP Extension Suite ................................ 21 The Cartweaver 3 Toolbar ..................................................................... 22 Step 3: Create a PHP Site ..................................................................... 23 Installation and Setup ............................................................................. 23 Step 1: Install Cartweaver .................................................................... 23 Step 2: Create the Database ................................................................. 25 Step 3: Create a Database Connection in Dreamweaver............................. 25 Step 4: Complete the Cartweaver 3 Setup ............................................... 25 The Presentation Files ............................................................................. 31 Step 1: Add a Search Form or Search Links ............................................. 32 Step 2: Add Search Results Include ........................................................ 34 Step 3: Add Product Details Include........................................................ 35 Step 4: Add Show Cart Include .............................................................. 35 Step 5: Add Order Form Include ............................................................ 35 Step 6: Add Confirmation Include........................................................... 36 Step 7: Add View Cart Link ................................................................... 36 Step 8: Add Login Form........................................................................ 36 Completing your Store ............................................................................ 37 Changing the Administrator Login .......................................................... 37 Changing Company Information............................................................. 37 Defining Shipping Settings .................................................................... 37 Creating Store Categories ..................................................................... 37 Secondary Categories .......................................................................... 38 Configuring Taxes................................................................................ 38

Cartweaver 3 PHP

Table Of Contents

Working with Products.......................................................................... 40 Managing Products .............................................................................. 41 Discounts ........................................................................................... 43 Section 5: Cart Files................................................................................ 46 application.php ...................................................................................... 46 Objects Declared:................................................................................ 46 CWIncGlobalSettings.php Global Application Settings ................................ 47 Properties: ......................................................................................... 47 CWIncSetup.php Setting up Cartweaver .................................................. 50 Session Variables ................................................................................ 50 CWIncFunctions.php Cartweaver Functions .............................................. 51 arrayFind ........................................................................................... 51 arrayKeyToArray ................................................................................. 52 arrayRemove ...................................................................................... 52 arrayValueList..................................................................................... 53 cartweaverMoney ................................................................................ 54 cwAltRow ........................................................................................... 54 cwDateFormat .................................................................................... 55 expandPath ........................................................................................ 55 getPageName ..................................................................................... 56 localPath ............................................................................................ 56 mySQLDate ........................................................................................ 57 sendEmail .......................................................................................... 57 Include Files .......................................................................................... 58 CWIncResults.php ............................................................................... 58 CWIncDetails.php ................................................................................ 58 CWIncShowCart.php ............................................................................ 58 CWIncOrderForm.php........................................................................... 59 CWIncLoginForm.php ........................................................................... 59 CWIncConfirmation.php........................................................................ 59 Classes ................................................................................................. 59 DB Database functionality .................................................................. 59 CWCart.............................................................................................. 64 Public Methods .................................................................................... 65 CWCart.............................................................................................. 65 add Add an item to the cart ................................................................ 65 update Update the cart item ............................................................... 65 getCartQty get the total cart quantity................................................... 66 multiOption add a multi-option item to the cart ..................................... 66 CWMail Mail ..................................................................................... 70 CWSearch Search/Navigation.............................................................. 71 Function Files and Functional Include Files.................................................. 74 CWDebugger.php Debugger ............................................................... 74 CWError Cartweaver error handling ..................................................... 75 CWFunCustomerAction Customer Action ............................................... 76 CWFunFindPassword Find Password ..................................................... 79
Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Table of Contents

CWFunOrderConfirmEmails Order Confirmation Email ............................. CWFunPriceList Price List.................................................................... CWIncProcessOrder Process Order....................................................... CWFunProductOptions Product Options................................................. CWFunSearchAction Search Action....................................................... CWFunShipping Shipping ................................................................... CWIncValidateOrderForm Validate Order Form....................................... Payment Processing Include Files .............................................................. CWIncAuthorizeNet.php........................................................................ CWIncPayflowPro.php .......................................................................... CWIncPayPal.php ................................................................................ CWIncWorldPay.php............................................................................. Supporting Files ..................................................................................... index.php........................................................................................... cartweaver.css.................................................................................... CWRequirementChecker Check requirements ........................................ Cartweaver MySQL Database.................................................................

80 82 82 83 85 86 87 89 89 90 91 92 94 94 94 95 95

Section 6: Administration Files ............................................................... 98 AdminHome.php .................................................................................... 98 application.php ...................................................................................... 98 Config.asp............................................................................................. 98 ConfigGroup.asp .................................................................................... 98 ConfigItem.asp ...................................................................................... 99 CustomerDetails.php............................................................................... 99 Customers.php ...................................................................................... 99 CWIncNav.php....................................................................................... 99 CWProductAction.php.............................................................................. 99 CWIncProductSearch.php ........................................................................ 99 CWValidateProduct.php ........................................................................... 99 DatePopUp.php ...................................................................................... 99 DiscountDetails.asp ................................................................................ 99 DiscountProdutList.asp ...........................................................................100 Error.php .............................................................................................100 index.php.............................................................................................100 ListAdminUsers.php ...............................................................................100 ListCategories.php.................................................................................100 ListConfigGroups.asp .............................................................................100 ListCountry.php ....................................................................................100 ListCreditCard.php.................................................................................100 ListDiscounts.asp ..................................................................................100 ListScndCategories.php ..........................................................................101 ListShipStatus.php ................................................................................101 ListTaxGroups.asp .................................................................................101 ListTaxRegions.asp ................................................................................101 Options.php .........................................................................................101 OrderDetails.php ...................................................................................101
4
Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Table Of Contents

Orders.php...........................................................................................101 ProductActive.php .................................................................................101 ProductArchive.php................................................................................101 ProductForm.php...................................................................................102 ProductImageUpload.php........................................................................102 Settings.php.........................................................................................102 ShipMethods.php...................................................................................102 ShipRange.asp......................................................................................102 ShipSettings.php...................................................................................102 ShipStateProv.php.................................................................................102 TaxGroup.asp .......................................................................................102 TaxGroupProducts.asp ...........................................................................102 TaxRegion.asp ......................................................................................103 Section 7: Database.............................................................................. 104 Overview and Relationships ....................................................................104 Table-By-Table Database Summary..........................................................104 tbl_adminusers ..................................................................................105 tbl_cart.............................................................................................105 tbl_config..........................................................................................105 tbl_configgroup ..................................................................................106 tbl_customers ....................................................................................106 tbl_custstate......................................................................................106 tbl_custtype ......................................................................................107 tbl_discount_amounts .........................................................................107 tbl_discount_apply_types ....................................................................107 tbl_discount_types .............................................................................107 tbl_discount_usage.............................................................................107 tbl_discounts .....................................................................................108 tbl_discounts_products_rel ..................................................................108 tbl_discounts_skus_rel ........................................................................108 tbl_list_ccards....................................................................................109 tbl_list_countries ................................................................................109 tbl_list_imagetypes.............................................................................109 tbl_list_optiontypes ............................................................................109 tbl_list_shipstatus ..............................................................................109 tbl_orders .........................................................................................110 tbl_orderskus.....................................................................................111 tbl_prdtcategories ..............................................................................111 tbl_prdtimages...................................................................................111 tbl_prdtscndcats.................................................................................111 tbl_prdtoption_rel...............................................................................112 tbl_prdtscndcat_rel.............................................................................112 tbl_products ......................................................................................112 tbl_shipmethcntry_rel .........................................................................112 tbl_shipmethod ..................................................................................113 tbl_shipweights ..................................................................................113
Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Table of Contents

tbl_skuoptions ...................................................................................113 tbl_skuoption_rel ...............................................................................113 tbl_skus............................................................................................114 tbl_stateprov .....................................................................................114 tbl_taxgroups ....................................................................................114 tbl_taxrates.......................................................................................114 tbl_taxregions....................................................................................115 Section 8: How things Work.................................................................. 116 Globally declaring variables in the application.php file .................................116 How Cartweaver Works ..........................................................................116 Typical Cart Flow...................................................................................117 Step 1: The Search.............................................................................117 Step 2: View Details ...........................................................................117 Step 3: View Cart ...............................................................................118 Step 4: Order Form ............................................................................118 Step 5: Final Checkout ........................................................................118 Step 6: Order Confirmation ..................................................................119 How Shipping is Calculated .....................................................................119 Charge Range Based On ......................................................................119 Enable Shipping .................................................................................120 Charge Base ......................................................................................120 Location Extension..............................................................................120 Sample Calculation .............................................................................120 Dialing in your Shipping Grid..............................................................121 Why not just use UPS or FedEx online? ..................................................121 Processing Credit Card Payments .............................................................122 Gateway or Processor..........................................................................122 How Real-Time Gateways Work ............................................................122 How Non-Real-Time Payment Processors Work........................................122 Section 9: Resources ............................................................................ 124 Recommended Reading ..........................................................................124 Recommended Web Sites .......................................................................124 Dreamweaver, MySQL, and PHP Resources .............................................124 SSL Certificates..................................................................................124 Payment Gateways .............................................................................124 Payment Processors ............................................................................125 Section 10: Support .............................................................................. 126 What is supported?................................................................................126 Support Newsgroup (NNTP Forum)...........................................................126 What is a newsgroup? .........................................................................126 Outlook Express Newsreader Setup .......................................................126 Appendix A: Updating Cartweaver Stores .............................................. 128 Updating Scenarios................................................................................129
6

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Table Of Contents

Scenario 1.........................................................................................129 Scenario 2.........................................................................................130 Scenario 3.........................................................................................130 Scenario 4.........................................................................................130 Update Solutions ...................................................................................130 Solution 1 .........................................................................................130 Solution 2 .........................................................................................132 Solution 3 .........................................................................................135 Solution 4 .........................................................................................136 Dealing with Numerous Changes..............................................................136 Appendix B: Updating Cartweaver Extensions ....................................... 138 Rename the Cartweaver Snippets Folder ...................................................138 Uninstall Cartweaver Extensions ..............................................................139 Install the Latest Version of Cartweaver ....................................................140 Appendix C: Folder Permissions for File Uploading ................................ 144 Windows ..............................................................................................144 Linux/Unix ...........................................................................................147

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP End User License Agreement Single Developer License


I.

This is an agreement by and between Application Dynamics Inc. ("Licensor"), parent company of Cartweaver and Cartweaver.com, and the End User ("Licensee"), who is being licensed as a one developer, ("Single Developer License", "License", "License Agreement") to use Cartweaver 3 PHP ("Software"). Licensee acknowledges that this is only a limited nonexclusive license. Licensor is and remains the owner of all titles, rights, and interests in the Software. This License permits Licensee to install the Software on more than one computer system for use solely by Licensee, as long as the Software will not be used on more than one computer system simultaneously. Licensee will not make copies of the Software or allow copies of the Software to be made by others, unless authorized by this License Agreement. Licensee may make copies of the Software for backup purposes only. Licensee is permitted to develop as many websites as the Licensee wishes using the Software. The Software may be used for the development of websites on behalf of the website owner/merchant, be that the Licensee or client(s) thereof. The Software, in whole or in part, may NOT be used for the development of applications for resale or distribution without the express written permission of the Licensor. Unless otherwise expressly authorized in a separate written agreement between, and executed by, you and Application Dynamics Inc., the following license restrictions apply: You may not rent, lease, sublicense, use and/or permit the use of the Software on a timeshare or service basis. In addition, you may not provide the Software as part of a hosting service, whether as a subscription basis or otherwise. This Software is subject to a limited warranty. Licensor warrants to Licensee that the Software will perform according to its printed documentation, and to the best of Licensor's knowledge Licensee's use of this Software according to the printed documentation is not an infringement of any third party's intellectual property rights. To the extent permitted by law, THE ABOVESTATED LIMITED WARRANTY REPLACES ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, AND LICENSOR DISCLAIMS ALL IMPLIED WARRANTIES INCLUDING ANY IMPLIED WARRANTY OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, OR OF FITNESS FOR A PARTICULAR PURPOSE. No agent of Licensor is authorized to make any other warranties or to modify this limited warranty. Licensee has specific legal rights pursuant to this warranty and, depending on Licensee's jurisdiction, may have additional rights.

II.

III.

IV.

V.

VI.

Cartweaver 3 PHP VII.

Cartweaver Software License Agreement

Notwithstanding the foregoing, LICENSOR IS NOT LIABLE TO LICENSEE FOR ANY DAMAGES, INCLUDING COMPENSATORY, SPECIAL, INCIDENTAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL DAMAGES, CONNECTED WITH OR RESULTING FROM THIS LICENSE AGREEMENT OR LICENSEE'S USE OF THIS SOFTWARE, whether based on lost revenue or otherwise, regardless of whether LICENSEE was advised of the possibility of such losses in advance. In no event shall LICENSOR's liability hereunder exceed the amount of license fees paid by Licensee, regardless of whether Licensee's claim is based on contract, tort, strict liability, product liability or otherwise. Licensee's jurisdiction may not allow such a limitation of damages, so this limitation may not apply. Licensee agrees to defend and indemnify Licensor and hold Licensor harmless from all claims, losses, damages, complaints, or expenses connected with or resulting from Licensee's business operations. Licensor has the right to terminate this License Agreement and Licensee's right to use this Software upon any material breach by Licensee. Licensee agrees to return to Licensor or to destroy all copies of the Software upon termination of the License. This License Agreement is the entire and exclusive agreement between Licensor and Licensee regarding this Software. This License Agreement replaces and supersedes all prior negotiations, dealings, and agreements between Licensor and Licensee regarding this Software. This license is subject to change without notice. This License Agreement is valid without Licensor's signature. It becomes effective upon the earlier of Licensee's signature, Licensee's use of the Software, or purchase of the Software. Cartweaver is copyright of Application Dynamics Inc. and its licensors. Macromedia, Dreamweaver, and/or Fireworks, are either registered trademarks, trademarks, or copyrights of Macromedia, Inc. in the United States of America and/or other countries. This License Agreement shall be governed by the laws of the State of Washington.

VIII.

IX. X. XI.

XII.

XIII.

XIV.

If you have any questions concerning this Agreement, or otherwise wish to contact a support person, write to: Application Dynamics Inc. support@cartweaver.com 1560 NE 10th East Wenatchee, WA 98802

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Section 1: Welcome to Cartweaver


Cartweaver 3 PHP (Cartweaver) was created for developers and designers alike, using Dreamweaver and PHP. With a few easy modifications to personalize your store you can quickly be set up and selling on the web. Cartweaver is developed using PHP and is therefore easy to learn and modify. The full PHP code is provided and can be modified or expanded by a developer. Before you get started, take a minute to look at the Definitions Section, which explains the names/terms used in this documentation.

The Cartweaver Shopping Cart


Cartweaver provides all the functionality youd expect from an online shopping cart. Your products are displayed in a catalog that is easily searchable Product details are readily accessible if the shopper wants to know more about an item Shoppers can easily place items in a shopping cart and check out when ready. Cartweaver is set up to integrate with online credit card processors and gateways (payment processors). Once an order has been verified through the payment processor, Cartweaver sends verification of a completed order to both the customer and the merchant.

Easy Integration!
If you're new to dynamically developed sites or just new to e-commerce, Cartweaver won't hold you back. Many of our customers have reported no previous development experience and have found that they have learned much about the dynamic development process by using Cartweaver. We've done our very best to make things easy for you. If you're a Dreamweaver MX or Dreamweaver MX 2004 user, you'll be able to take advantage of the Cartweaver 3 PHP extension suite. The Step-By-Step section of this manual provides you with everything you need to do to get your Cartweaver site up and going. Tip
Cartweaver is fully documented and the code is extensively commented, so any time you want to know what is going on or how something works just switch to Code view and read the Comment Lines.

Cartweaver 3 PHP

Welcome to Cartweaver

If you're not using Dreamweaver, a copy of the entire Cartweaver 3 PHP application is provided in Cartweaver3PHP.zip. Everything you need to know is either in this documentation and/or commented in the code.

Separating Form from Function


A key principle followed throughout Cartweaver is to separate functionality from design. All Cartweaver functionality is placed within your existing design via includes, functions and objects. Whether you use the Cartweaver 3 PHP extension suite in Dreamweaver or handcode in Dreamweavers Code view, Homesite+, or some other editor, you will be able to easily place Cartweavers functionality in your existing site design.

Completely Customizable
Even though Cartweaver is developed to be easy to integrate, it is still completely customizable. Should the need arise you can customize the application files to suit your needs. We believe Cartweaver is the best marriage of ease-of-use and customizability ever offered in an e-commerce application.

The Administration Area


Cartweaver comes with an extensive password protected browser based Administration Area which includes product, order, shipping and customer administration capabilities as well as other important data about your store. Simply set up additional usernames and passwords for as many site administrators as needed for your store. For quick and easy reference, context-sensitive help is provided which fully explains the function of each page for quick and easy reference.

The Cartweaver 3 Database


The Cartweaver 3 database is built in MySQL. The Administration Area is provided to make populating the database easy for a store's administrator(s). If youre not using the extension to install Cartweaver youll find the MySQL database script in the zip file.

The Cartweaver Customer Area


The Cartweaver Customer Area is available to provide helpful information to Cartweaver customers. This is also where you'll find Cartweaver Add-Ons. To enter the Customer Area, visit www.cartweaver.com and login with the username and password you were provided after purchasing Cartweaver.

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

11

Cartweaver 3 PHP

Welcome to Cartweaver

Conventions Used in this Manual


As you work through this manual, keep in mind the following conventions used: Filenames appear like this: Myfilename.php PHP code, variable names <?php echo($myvar); ?> and variable values appear like this:

Notes are provided throughout the document. Notes contain important information about the application. Notes appear like this: Note
Note text.

Tips are helpful hints about the application. Tips appear like this: Tip
Tip text.

12

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Section 2: Definition of Terms


The following is a list of all of the common terms used throughout the Cartweaver 3 PHP application and this documentation. Admin Files: All files in the Cartweaver Administration section. Administration Area: Cartweaver comes complete with a full online Administration Area for managing your online store. The Administration Area is located at http://www.yoursite.com/storeroot/cw3/Admin/. Application Files: These are files needed to make Cartweaver function but are not visible to the shopper. Archived: To maintain data referential integrity some records cannot be deleted if they have associated records; product SKUs with associated orders for example. In these situations the records can be archived, meaning they are hidden from the web and moved off of main Admin lists to Archive lists. Cart Files: Cart files are all the files that are visible to the shopper or related to these files via includes or function calls. Cartweaver Store Root Folder: The Cartweaver store root folder is the directory where you installed Cartweaver 3. Class: A PHP Class is a custom class which allows the developer to reference properties and call methods against it. Cartweaver uses several custom classes for application logic, including Cartweaver, DB, and CWSearch. Crosstab Table: A crosstab table is a table that groups data both horizontally and vertically. In the Cartweaver application, products that have more than three options can be displayed in a crosstab table (by setting the Details Display option to Tables). With this type of display, the options are listed across the top, the SKUs are listed down the left hand side, and the values are displayed in the center. Custom Functions: Custom functions are used throughout Cartweaver to separate the application logic from your design. Cartweaver uses a global functions file to maintain all of the functions related to the Cartweaver application. This consolidation of functions throughout Cartweaver allows for rapid application development and code reuse. Functional Includes: Nearly all of Cartweavers cart functionality is placed in your site's presentation files via functional includes. The Server behaviors that insert Cartweaver features place <?php include("pagename.php");?> calls and descriptive comments into your documents. The exception is the Search/Navigation feature, which uses a custom PHP object instantiation of the CWSearch class.

Cartweaver 3 PHP

Definition of Terms

Payment Gateway: A payment gateway is a third party that processes credit card information for you in real time. The transaction is processed in-line and the page will not be completed until a response is received from the gateway. This allows the rest of the code on the page to be processed based on the results of the gateway transaction. This transaction is invisible to the shopper. Common examples of payment gateways are Verisigns Payflow Pro and Authorize Net. Payment Processor: When interacting with a payment processor, the transaction takes place non-real-time. The order is written to the Cartweaver database, and then the customer enters their payment information on the processors website. The results will be sent separately to the merchant or to your application via email or to a different file that the processors server is pointed to. In this situation some sort of order verification and validation system must be put in place to update the order records to show when the credit card transaction has been completed and the payment is valid, or not. Common examples of this type of system are PayPal, 2Checkout and WorldPay. Presentation Files: Presentation files contain your design and user interface. You will be adding Cartweaver functionality to your presentation files via the Cartweaver 3 PHP extension suite, or if you are hand coding in Dreamweavers Code view or in HomeSite+ or other text editors you will be adding Cartweaver functionality via <?php include("pagename.php");?> calls. Separating form from function this way makes your application easy to design, customize and maintain. Product: A product ID is a unique ID for a particular product. Product IDs must be unique within the database. See the Cartweaver Step-By-Step section for information on how product IDs are used inside the Cartweaver application. SKU (also referred to as Product SKU): SKU stands for Stock Keeping Unit. This is the industry standard way to refer to a specific product item. Consult the Cartweaver Step-By-Step section for more explanation on how SKUs function in Cartweaver. Supporting Files: Supporting files refers to the additional files installed with Cartweaver 3, which do not qualify as admin files, application files, functional includes, or presentation files. Supporting files include all assets, cartweaver.css, images and the Cartweaver Access database file. Target Page: The go-to page for a Cartweaver functional include is called a target page. For example, when you click View Cart (in the Cart Links class) the target page will be the presentation page that contains the CWIncShowCart.php functional include. showcart.php is the default, but the target page can be customized to fit your naming scheme. The target page variables are set by the Setup server behavior in the application.php file and are defined when you install Cartweaver into an existing site for the first time.

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

15

Cartweaver 3 PHP

Welcome to Cartweaver

Tax Group: Tax Groups define a collection of products that are similarly taxed. Examples of tax groups might include Electronics, Books, or Food Items. Each Tax Group should uniquely identify a single collection of products that should be taxed. Tax Region: A Tax Region is the physical location that taxes will be based upon. Tax Regions can either be entire countries, or individual states or provinces within a country. Each Tax Region can have its own Tax Rates for each Tax Group defined. Tax Rate: A Tax Rate is a percentage to be charged on an item in a particular Tax Group and Tax Region. Tax Rates can differ between groups and between regions. For example, the Tax Rate for Books (the Tax Group) in the United Kingdom (the Tax Region) can be different than the Tax Rate for Books in the United States: Texas (the Tax Region).

16

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Section 3: Directory Structure and Cart Flow Map


Directory Structure
Cartweavers functional design depends heavily on the directory structure of the application. This directory structure can be modified, but keep in mind that the structure mapping of the files will need to be modified as well. This can be rather involved so you should weigh carefully whether any benefit from changing the directory structure will be worth the time involved. Cartweaver is only officially supported in the default directory structure.

Cartweaver Presentation Files, Error Files and application.php Cartweaver Application Directory Administration Area Admin CSS and JavaScript Files Administration Graphics Administration Help Files Cartweaver Store Assets Credit Cart Images CSS Files Expand (popup) Product Images Full Size Product Images Small Product Images Thumbnail Product Images Shared JavaScript Files Cartweaver functions Payment Processing functions Database and Locale Setup Files MySQL Database Setup Files UNIX/Linux Locale Files

Cartweaver 3 PHP

Directory Structure and Cart Flow Map

Cart Flow Map


This Map shows the default flow of a Cartweaver site. You can of course add many files to the catalog/cart portion of your site but the basic flow will remain the same. The default target page names are listed below, along with names of the functional includes that place the cart functionality on the page. The filenames are up to you; the default (suggested) filenames are provided and stored in the CWIncGlobalSettings.php file as defaults, but you may change them to anything you like. The target page variables are defined in application.php where your chosen filenames for each are provided. These target page variables tell the Results include which file to link to in order to show the Details and the Details Include which file to link to in order to Show Cart and so forth. For more detailed information, see the How Things Work section. Perform any search using the Cartweaver Search/Navigation server behavior

results.php - CWIncResults.php

details..php - CWIncDetails.php

showcart.php - CWIncShowCart.php

orderform.php - CWIncOrderForm.php

showcart.php CWIncShowCart.php, when $_SESSION["CheckingOut"] is true, final checkout form is displayed

confirmation.php - CWIncConfirmation.php

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

19

Section 4: Cartweaver Step-By-Step


Whether you're adding Cartweaver to an existing site or starting from scratch, the process has been made as simple as possible. There are a few things you'll need to do before you get started, which will be covered in the Preparation section. If you already have a PHP testing server, have installed the Cartweaver 3 PHP extensions and created a PHP site in Dreamweaver, you may skip to the Installation and Setup section. After you've completed the installation, created a database connection, and completed the Setup server behavior, you'll be ready to move on to The Presentation Files section, and then youll learn how to complete your Cartweaver store through Administration Area. Note
This section assumes you are already familiar with a web site with Macromedia Dreamweaver MX, Macromedia Dreamweaver MX 2004, or Macromedia Dreamweaver 8. If you are not, please refer to the Macromedia documentation or other published works regarding how to use Dreamweaver.

Preparation
The following three steps describe everything you need to do before you get started building your Cartweaver site. You'll only need to complete steps 1 and 2 once. For each Cartweaver site you develop, you'll need to complete step 3.

Step 1: Install a PHP Application Server and Web Server


You should resist the temptation to test your development work on the production/host server. Testing on a production server, especially a shared hosting server, is a good way to become very unpopular. If your code, for whatever reason, should cause a server problem you could disrupt not only your application but also all other applications running on the server. If youre using either Windows 2000 or Windows XP Professional you have a copy of IIS on your Windows installation CD. IIS can be used as a web server with PHP, although Apache Web server is recommended. To install IIS, open your Windows Control Panel and double-click Add/Remove Programs. From the Add/Remove Programs dialog, choose Add/Remove Windows Components icon on the left hand side, and then select the Internet Information Services (IIS) component and follow the on-screen instructions. Once IIS is fully installed, you can find all of the IIS documentation at http://localhost/iisHelp/. For additional help with installing and configuring IIS see Microsofts Internet Information Services 5.0 Support Center at

Cartweaver 3 PHP

Cartweaver Step-by-Step

http://www.cartweaver.com/go/IIS5Support. Once IIS is installed, PHP can be installed with the install package located at http://www.php.net/downloads.php. Double-click the installer and follow the instructions. Information on downloading, configuring, and installing Apache web server is located at http://www.apache.org. Apache and PHP can also be installed locally on Macintosh computers. An article on installing the servers can be found on the Macromedia site at http://www.cartweaver.com/go/PHPMac. Additionally, you should be aware that most PHP hosting companies use Unix or Linux servers, and PHP code is not fully compatible across servers. The standard out-of-the-box Cartweaver code will run equally well on both servers, however. There are many distributions of Linux available, and installation/configuration will vary for each. Information on installing and configuring Apache, PHP, and MySQL can be found online or in the installation packages for the Linux distribution that you are running.

Step 2: Install the Cartweaver 3 PHP Extension Suite


Installing the Cartweaver 3 PHP extension suite is necessary to add Cartweaver compatibility to Dreamweaver. The easiest way to do this is to browse to the Cartweaver3PHP.mxp file and double click on it. This will launch the Extension Manager and install Cartweaver 3 PHP for you. Note
When prompted to overwrite files, only click Yes when the file being installed is the same or newer, never choose Yes to All. See Appendix B: Updating Cartweaver Extensions for more information.

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

21

Cartweaver 3 PHP

Cartweaver Step-by-Step

Figure 4.1 Macromedia Extension Manager

The Cartweaver 3 Toolbar


If you prefer buttons to menus, you should also install the Cartweaver 3 Toolbar, Cartweaver3Toolbar.mxp. The toolbar is optional; all functionality built into the toolbar is also available under the Cartweaver menu (next to Dreamweavers Help menu). The Cartweaver 3 toolbar is shared by all versions of Cartweaver (ASP, ColdFusion, and PHP). If you own more than one version of Cartweaver, the toolbar is able to determine the type of document you are using and insert the code accordingly. If you do not own a version of Cartweaver that is compatible with the current document, you will get an error message and no code will be added to the page. Tip
You may have noticed that in Dreamweaver there's usually at least two ways to do the same thing. Such is also the case with the Cartweaver extension suite. Please refer to the description in the Extension Manager for information on how to access the extensions. It is up to you to decide which method usually the Cartweaver 3 toolbar, or the Cartweaver menu that you prefer.

Because the toolbar works with all versions of Cartweaver, you only need to install Cartweaver3Toolbar.mxp once even if you have more than one version of Cartweaver installed.

22

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Step 3: Create a PHP Site


Create a new PHP site in Dreamweaver or select an existing site you wish to use as your Cartweaver site. In order to be able to properly test and develop your Cartweaver 3 application the testing site folder must be in the web root of your server running PHP. If on Windows and you accepted the defaults during the IIS setup, the folder would be C:\inetpub\wwwroot\YourCartweaverSite. The defaults for an Apache web server would be located at C:\Program Files\Apache Group\Apache2\htdocs on a Windows machine. On a Macintosh, the web sites are typically located in the Sites\[Username] folder. To make sure PHP is running, you can place a test file into the folder with the following text in it: <?php phpinfo() ?> Name the file test.php and browse to it using your local URL (such as http://127.0.0.1/YourCartweaverSite/test.php). You should see a test page showing the PHP version and all server variables and settings. For more information about creating a PHP site and setting up the Testing Server information for the site, consult the Dreamweaver help documentation. Ensure that you choose PHP MySQL as your testing server to enable the Cartweaver server behaviors.

Installation and Setup


For every Cartweaver site that you develop, you'll need to install the Cartweaver 3 files, create a database connection, and apply the Setup server behavior.

Step 1: Install Cartweaver


Installing the Cartweaver application into your site is a breeze with the Install Cartweaver 3 command. Either choose Cartweaver 3 PHP > Install Cartweaver 3 from the Cartweaver menu or click the Install Cartweaver 3 button on the Cartweaver toolbar and choose PHP from the menu to begin the installation.

Figure 4.2 Cartweaver Installation Menu

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

23

Cartweaver 3 PHP

Cartweaver Step-by-Step

The Install Cartweaver 3 dialog will open with your currently selected site selected:

Figure 4.3 Install Cartweaver 3 Dialog

The options are as follows: Select Site: This is the site that you wish to install Cartweaver into. Application Folder: This is the folder where all of the Cartweaver files will be placed, including the application.php file, all presentation files, supporting files and admin files. You can click the browse icon to choose the folder you want to install into or leave the field blank to install into the root of your site. This field must contain a path to a folder that already exists inside the selected site, and the folder may not already contain an instance of the Cartweaver 3 application. Select Installed Files in Site?: Check this box to have all of the installed Cartweaver files selected in the Files panel once the installation is complete. This makes it easy to quickly upload all of the installed files. This checkbox will remember your last choice the next time you install Cartweaver. Once Cartweaver has been successfully installed you will see the following alert:

Figure 4.4 Cartweaver 3 PHP Installation Complete dialog

24

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Note
If there were any problems during the installation, such as a file that could not be created or overwritten, then you will receive an alert to check the cw3ErrorLog.txt file located in your Cartweaver installation directory. This will tell you exactly which files were not created or overwritten.

Step 2: Create the Database


Cartweaver PHP uses MySQL as its database. If you have not installed MySQL, go to the MySQL site at http://www.mysql.com and download the latest version. Installation instructions can be found at the site as well. Once the database server is up and running, you can create the sample Cartweaver database. The cw3/setup/database folder contains all of the file necessary to create the MySQL database. There are two ways to create your database: 1. Upload the setup directory and browse to the CWGenerateDatabase.php file to generate your MySQL database. Use the URL of your Cartweaver installation, such as http://localhost/cw3/setup. Click the link to Generate Cartweaver Database and answer the questions on the page to create the database and pre-populate it with sample data. If you are comfortable with any of the MySQL front ends (such as DB Manager Pro or MySQL Front), you can load and run the Cartweaver3mysql.sql script to create a blank database. If you want sample data included in the database, you can also run Cartweaver3mysqldata.sql.

2.

Step 3: Create a Database Connection in Dreamweaver


Cartweaver PHP uses custom recordset code that does not require a database connection to be defined in Dreamweaver. However, if you want to add recordsets or other dynamic code of your own, you can create a connection in Dreamweaver. Consult the Dreamweaver documentation on creating database connections if you have never set up a database connection in Dreamweaver. Alternatively, you can create recordsets and dynamic code using Cartweavers custom recordset code using the Cartweaver snippets. This will require some knowledge of PHP coding, however, and you will also not be able to use Dreamweavers standard server behaviors.

Step 4: Complete the Cartweaver 3 Setup


Open application.php in your Cartweaver store root folder. If you select Cartweaver > Cartweaver 3 PHP > Setup or click the Cartweaver 3 Setup button in the Cartweaver 3 toolbar, you will be prompted to double click the Cartweaver 3 Setup server behavior in the Server Behaviors panel (Window > Server Behaviors). The
25

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

button and menu are not only there to help guide you, but also to apply new instances to an application.php if you did not allow it to be created at the time of installation. Note
If application.php was not created during installation, you will need to apply the Cartweaver 3 Setup to your application.php file.

Figure 4.5 Server Behaviors panel in application.php

Double clicking the Cartweaver 3 Setup server behavior will open the Setup dialog. Note
If you see a red exclamation point next to the Cartweaver 3 Setup server behavior in the Server Behaviors panel, you will not be able to double-click the server behavior to modify it. If you attempt to do so you will see the following message:

Connection Information
The Connection category contains all of the information for connecting to your Cartweaver database. Choose a connection type and complete the necessary fields.

26

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Figure 4.6 Connection category

Hostname: This field should contain the IP address, domain name or machine name to the MySQL Server which holds your database. This may or may not be the same as the address for your sites web server. If you are working on a remote server contact your host in order to determine the address for your MySQL Server. If you are testing locally, you should use 127.0.0.1. Database Name: This field should contain the name of your database on the MySQL Server specified in the Hostname field. The Database Name should be the same name specified during the database creation using generateDatabase.php. If youre unsure what this value should be, contact your host in order to determine the name of your MySQL Server database. Username: This field should contain the Username to access your database. The Username should be the same Username specified during the database creation using generateDatabase.php. If youre unsure what this value should be, contact your host in order to determine the Username of your MySQL Server database. Password: This field should contain the Password for the Username to access your database. The Password should be the same password specified during the database creation using generateDatabase.php. If youre unsure what this value should be, contact your host in order to determine the password of your MySQL Server database.

Website Information
The Website category contains information pertaining to the URL of your store.

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

27

Cartweaver 3 PHP

Cartweaver Step-by-Step

Figure 4.7 Website category

URL: Determines the base URL for your Cartweaver store. This value is optional, but should be used if you are using an SSL certificate for your store. If this field is left blank then all links in the Cartweaver store will be document relative based on the location of your presentation files. This URL should be the absolute path to your stores presentation files under your nonSSL enabled domain name, such as http://www.yoursite.com/. The trailing slash is required. SSL URL: Determines the secure URL to use for payment processing for your Cartweaver store. Leave this value blank if you are not using a payment gateway or processor that requires you to collect credit cards information. If you are accepting credit cards this value should be the https:// version of your domain, or the location of a shared SSL provided by your host, such as https://www.yoursite.com/ or https://www.sharedssl.com/yoursite/. You should only use this setting when you have a valid secure site available. The trailing slash is required.

Presentation Information
The Presentation category contains all of the settings for your page names and display settings. The names for each page in your site are defined here, along with how many items to display in search results, and what to do when a user adds an item to their cart.

28

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Figure 4.8 Website category

Add to Cart Action: Determines whether to confirm the Add to Cart action on the Current Page or to send the user to the View/Show Cart Page. (See the onSubmitAction description for CWIncGlobalSettings.php in the Section 5: Cart Files section for more information.) Results Page: The page that users will be sent to for default search actions. See the results description for CWIncGlobalSettings.php in the Cart Files section for more information. Check the adjacent Create? checkbox in order to have this file created for you with the CWIncResults.php already included in the file. The default value is results.php. Details Page: The page that users will be sent to when they click a link to show order details, whether through search results or an Upsell link on another products detail page. See the details description for CWIncGlobalSettings.php in the Cart Files section for more information. Check the adjacent Create? checkbox in order to have this file created for you with the CWIncDetails.php already included in the file. The default value is details.php. Details Display Type: Determines the method in which product options will be displayed on the Details Page. See the detailsDisplay description for CWIncGlobalSettings.php in the Cart Files section for more information. The default value is Advanced JavaScript. View/Show Cart Page: The page that users will be sent to when they click a View Cart link or if the Add to Cart Action is set to View/Show Cart Page, the page a user will be sent to when they add an item to their cart. See the goToCart description for CWIncGlobalSettings.php in the Cart Files section for more information. Check the adjacent Create? Checkbox in order to have

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

29

Cartweaver 3 PHP

Cartweaver Step-by-Step

this file created for you with the CWIncShowCart.php already included in the file. The default value is showcart.php. Checkout/Order Form Page: The page that users will be sent to when they click the Checkout button. See the orderForm description for CWIncGlobalSettings.php in the Cart Files section for more information. Check the adjacent Create? checkbox in order to have this file created for you with the CWIncOrderForm.php already included in the file. The default value is orderform.php. Confirmation Page: The page that users will be sent to once they have successfully completed an order. See the confirmation description for CWIncGlobalSettings.php in the Cart Files section for more information. Check the adjacent Create? checkbox in order to have this file created for you with the CWIncConfirmation.php already included in the file. The default value is confirmation.php.

Miscellaneous Information
The Miscellaneous category contains those settings that dont fit into the other categories, such as component selections, locale settings and payment processor information.

Figure 4.9 Miscellaneous category

Locale: Select the operating system for the server hosting your site in order to determine the locale for date and currency formatting. If you are using a Unix or Linux server upload and browse to /setup/CWGetLocales.php in order to determine the locales supported by the server hosting the site. If the locale you need is not in the list provided, type the value in manually. If you are using a Windows server, choose the locale from the list provided.

30

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Payment Processor: Choose the appropriate payment processor or gateway for your store. The appropriate processor file will be copied to the /cw3/CWLibrary/ProcessPayment folder. See the descriptions for each payment processor in the Cart Files section of this document for more information on configuring your payment processor once the Cartweaver Setup is complete. Debug Password: The debug password is used to enable debugging on live sites. Add the querystring variable debug=[debug password] to the end of any URL in the site in order to show the Cartweaver debugging information. For example, on the sites index.php page, you would use http://yoursite.com/index.php?debug=myPassword to show the debugging output. The debug password should be alphanumeric with no special characters or spaces. Once youve completed the dialog click OK to set all of the values in the application.php file. Tip
All of the Create? checkboxes are sticky. This means that the dialog will remember your previous choice checked or unchecked and use that preference the next time you invoke the dialog.

The Presentation Files


The files that the end user will be viewing are referred to as presentation files. One of the benefits to using Cartweaver is that the design of your Cartweaver site is entirely up to you. You're not locked into a default design built by Cartweaver; you decide what your site looks like and simply plug in the Cartweaver pieces. If you chose to create each of the presentation files when applying the Setup server behavior, you'll be able to open each file and customize the look and feel of the pages to suit your needs. You can either apply a template, or add your own design and/or <?php include("filename.php"); ?> to complete the design of the presentation files. All that's left is to apply the Search/Navigation server behavior to each presentation file, or you can use a <?php include("filename.php"); ?> that you add to each presentation file. In other words, you only need to use the Search/Navigation server behavior, since the remaining commands are already applied to the files created by the Setup server behavior. If you've already developed a design for your site, you'll need to have each of the presentation files required for Cartweaver. You should have already supplied the file names in the Setup server behavior. First apply the Search/Navigation server behavior to each presentation file, or to an <?php include("filename.php"); ?> that you add to each presentation file. For each of these files, you'll need to apply
31

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

the appropriate command from either the Cartweaver 3 toolbar or the Cartweaver > Cartweaver 3 PHP submenu. Note
It is critical that the presentation files are located in your Cartweaver store root folder. Moving these files outside the Cartweaver store root will cause errors, and is not supported.

Step 1: Add a Search Form or Search Links


Figure 4.10 Search/Navigation Server Behavior button

The Cartweaver Search/Navigation server behavior is used to add either a search form, or a set of text links to each of the categories in the site. You may add a Search/Navigation server behavior to any PHP file that is in your Cartweaver store root folder. Tip
You'll find examples of various search forms and text navigation links in index.php located in your Cartweaver store root folder.

With any PHP file open, choose Cartweaver> Cartweaver 3 CF> Search/Navigation or click the Search/Navigation icon in the Cartweaver toolbar to add a Cartweaver Search/Navigation object to the page.

Figure 4.11 Search/Navigation server behavior dialog

32

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Type: Determines which type of search to display to the user. The default value is Search Form. The possible values are: Search Form: Displays a search form with the requested form fields passed through the Form related Arguments. Text Navigation Links: Displays a list of links for each category formatted with the Links related Arguments. Action Page (Optional): The page to submit the search criteria to. If you leave this field blank then targetResults will be used as the action page, as defined in application.php. Search Form Options The Search Form Options will be enabled if the Type is set to Search Form. Keywords: Check this box to include a search text field. The Keywords Label field will be enabled if this option is chosen. Category: Check this box to include a category <select> menu. The Category Label field will be enabled if this option is chosen. Secondary: Check this box to include a secondary category <select> menu. The Secondary Label field will be enabled if this option is chosen. Form Name/ID: The form name and ID to be applied to the <form> tag. This value is also used as a prefix to the preset IDs for other search form elements. For each Search/Navigation server behavior applied, this value should be unique. The default value is Search. Button Label: The text to be used for the submit button of the search form. The default value is Search. Keywords Label: The default text to be entered into the keyword search field. The default value is Enter Keyword(s). Category Label: The text to use for the All Categories entry of the select field. The default value is Select Category. Secondary Label: The text to use for the All Secondary Categories entry of the select field. The default value is Select Secondary Category. Text Navigation Links Options The Text Navigation Links Search Options will be enabled if the Search Type is set to Links.
33

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

All Categories Label: The label used for the All Categories link. The default value is All. Separator: Determines the string to be placed between each link. If you want to display links vertically you can pass HTML code, such as the <br /> tag, through this attribute. The select menu includes several predefined options: |, ::, <br> and <br />. You may type any separator into the field. Code Before Selected Link: Determines the string to be placed before a selected link. You can pass HTML code through this attribute. Code After Selected Link: Determines the string to be placed after a selected link. You can pass HTML code through this attribute. After completing the dialog, click OK to add the Search to your page. Dreamweaver will render your selected options in Design view so that you can see how the search will fit into your overall design. Note
Be careful if you decide to hand-code any of the properties of the CWSearch object added by the Search/Navigation server behavior. Some of the Arguments require that you escape any double quotes, such as <span class=\"mysearch\">. It is best to always use the Search/Navigation interface to apply changes as the extension handles all quote escaping automatically.

Tip
If you need to modify an existing Search/Navigation server behavior, doubleclick on Search/Navigation in the Server Behaviors panel. This will allow you to make the changes and ensures that the Arguments are properly encoded.

Figure 4.12 Cartweaver 3 Search/Navigation server behavior in the Server Behaviors panel

Step 2: Add Search Results Include


Figure 4.13 Add Search Results include button

34

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

If you chose not to have the Results Page created for you in the Cartweaver 3 Setup, open your Results Page and place the insertion point where you want your search results to be displayed and choose Cartweaver> Cartweaver 3 CF> Results or click the Results button in the Cartweaver toolbar. The CWIncResults.php file will be included at the insertion point. Tip
The toolbar buttons which do not require a dialog for input are tied to their relevant snippets in the Snippets panel. If you change a snippet that is inserted by the Cartweaver toolbar, it will reflect your changes. This allows you to modify the code that is inserted based on your own needs. Please be sure to review the Updating Cartweaver Extensions appendix if you customize any of the Cartweaver snippets. If you rename or delete any of the snippets that are inserted by the toolbar, the default code will be inserted for you.

Step 3: Add Product Details Include


Figure 4.14 Add Product Details include button

If you chose not to have the Details Page created for you in the Cartweaver 3 Setup, open your Details Page and place the insertion point where you want the product details to be displayed and choose Cartweaver> Cartweaver 3 CF> Details or click the Details button in the Cartweaver toolbar. The CWIncDetails.php file will be included at the insertion point.

Step 4: Add Show Cart Include


Figure 4.15 Add Show Cart include button

If you chose not to have the Show Cart Page created for you in the Cartweaver 3 Setup, open your Show Cart Page and place the insertion point where you want the cart details and checkout information to be displayed and choose Cartweaver> Cartweaver 3 CF> Show Cart or click the Show Cart button in the Cartweaver toolbar. The CWIncShowCart.php file will be included at the insertion point.

Step 5: Add Order Form Include


Figure 4.16 Add Order Form include button

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

35

Cartweaver 3 PHP

Cartweaver Step-by-Step

If you chose not to have the Order Form Page created for you in the Cartweaver 3 Setup, open your Order Form Page and place the insertion point where you want the order form to be displayed and choose Cartweaver> Cartweaver 3 CF> Order Form or click the Order Form button in the Cartweaver toolbar. The CWIncOrderForm.php file will be included at the insertion point.

Step 6: Add Confirmation Include


Figure 4.17 Add Confirmation include button

If you chose not to have the Confirmation Page created for you in the Cartweaver 3 Setup, open your Confirmation Page and place the insertion point where you want the customers order confirmation to be displayed and choose Cartweaver> Cartweaver 3 CF> Confirmation or click the Confirmation button in the Cartweaver toolbar. The CWIncOrderForm.php file will be included at the insertion point.

Step 7: Add View Cart Link


Figure 4.18 Add View Cart Link button

A View Cart text link may be added to any PHP file in your Cartweaver store root folder. You can place a link to the View Cart page anywhere in your application by using the View Cart include. To place the View Cart include, place the insertion point where you want the link to be displayed and choose Cartweaver> Cartweaver 3 CF> View Cart Link or click the View Cart Link button in the Cartweaver toolbar. The <?php echo($cartweaver->cartLinks());?> include file call will be added at the insertion point.

Step 8: Add Login Form


Figure 4.19 Add Login button

A Login form may be added to any PHP file in your Cartweaver store root folder. You can place the login anywhere in your application by using the Login Form include. To place the Login Form include, place the insertion point where you want the form to be displayed and choose Cartweaver> Cartweaver 3 CF> Login Form or click the Login Form button in the Cartweaver toolbar. The <?php include("cw3/CWIncLoginForm.php");?> include file call will be added at the insertion point.

36

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Completing your Store


Once you've created all of your Cartweaver files, you can then upload the files to your testing or production server and begin creating your product catalog. To begin you'll need to log into the Administration Area. The Administration Area is located in the Cartweaver store root below cw3/Admin/. If you installed Cartweaver at the root of your site, the Admin would be located at http://yoursite.com/cw3/Admin/. The default username is Admin and the password is Admin.

Changing the Administrator Login


Once logged into the Administration Area, the first thing you should do is click Lists in the Cartweaver admin menu and click Admin Users. Add a new administrator with your own username and password, and delete the default Admin username.

Changing Company Information


You can specify your own company information for the verification emails sent to your customers. In the Administration Area click Store Settings > Company Info and complete the Company Information form.

Defining Shipping Settings


After your company settings are complete, begin configuring your shipping settings. All of the shipping settings are located under the Shipping menu of the Administration Area. You can find more information on setting up your shipping settings by clicking the Help link on each of the shipping configuration pages or referencing the shipping portion of the How Things Work section.

Creating Store Categories


Products are categorized and identified by as many as four layers of search criteria: product, category, secondary category and keywords. The larger number of products you carry, the more search options you should offer to help your customer narrow down what he/she is looking for. You may add an unlimited number of categories or delete/archive existing categories. The category list in the Administration Area, under Lists > Categories, determines the choices available to the customer when searching your site, and the choices you have when assigning a category to a product. Categories are your top-level search filter and for that reason each product can only be associated with one category. If you have products that seem to fit in more that one category, take time to rethink how you have categorized them. A category
37

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

should be broad enough to cover everything associated with it. Department stores are a good example of this, for example: house wares, clothing, jewelry and so forth. It is, however, possible to assign a product to multiple categories. The sort order field for each category allows you to force the order in which the categories are sorted, rather than relying on alphabetical sorting. Categories are first sorted by the Sort Order value, and then alphabetically. Note
Categories that are associated with products cannot be deleted. Doing so would make the products in that category unavailable. If you want to no longer use one of these categories you can "archive" it, which will remove it from view on the web and in the Product Admin area.

Secondary Categories
Secondary categories act as subcategories, but they can be searched on directly without an associated category. A product can be related to an unlimited number of secondary categories.

Sorting
The sort order field for each secondary category allows you to force the order in which the secondary categories are sorted, rather than relying on alphabetical sorting. Secondary categories are first sorted by the Sort Order value, and then alphabetically.

Powerful Search Solution


The real power in this is the flexibility with which products can be searched for. For example, you can narrow or refine a search using secondary categories by searching for Clothing (category) / Men's (secondary category). In this way the secondary category acts like a traditional subcategory. Because there is no direct relationship between categories and secondary categories, you can easily widen your search by searching for Men's (secondary category only). This will return results of all products with a relationship to the Men's secondary category, regardless of what category they are in.

Configuring Taxes
Before you begin entering products into the database, you should define as much of your stores tax information as possible. This will make it easier to complete the product data entry, as there will be no need to return to the products to assign tax values later. The recommended procedure for configuring your stores tax information is to first define all of the appropriate Tax Regions, and then the Tax Groups. Once these two
38

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

steps are complete you can begin configuring all of the Tax Rates for each Group and Region. Note
How you configure taxes depends local laws and regulations. It is your responsibility to determine the configuration necessary to satisfy legal tax requirements. The following tax configuration related information is intended as an overview only. Additional help is provided on each page in the Cartweaver admin.

Defining Tax Regions


Tax Regions specify a geographical region for which the store is responsible for paying taxes. Tax Regions can be defined at the Country level, as well as the State or Province level. Each Tax Region can have its own Tax Rates for each defined Tax Group. To add a new Tax Region, click on Shipping/Tax in the Cartweaver menu, and then click Tax Regions. Complete the form at the top of the page and click Add. The new Tax Region will display at the bottom of the page.

Defining Tax Groups


Tax Groups define a collection of products that are taxed at the same rate. Examples of Tax Groups might include Books, Electronics, and Food Items. Each Tax Group uniquely defines a specific type of taxable product. To add a new Tax Group, click on Shipping/Tax in the Cartweaver menu, and then click Tax Groups. Complete the form at the top of the page and click Add. The new Tax Group will display at the bottom of the page.

Defining Tax Rates


Tax Rates can be defined by going through either the Tax Groups or Tax Regions page in the Cartweaver admin area. Each Tax Group can have Tax Rates defined in any number of Tax Regions. This provides a large amount of flexibility in how the tax configuration is set up. To define a Tax Rate, click on either the Tax Groups or Tax Regions link under the Shipping/Tax menu in the Cartweaver admin. Click on either the Tax Group or the Tax Region to be configured. When editing the Tax Group or Tax Region, add new Tax Rates by choosing the group or region to which the Tax Rate should be assigned.

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

39

Cartweaver 3 PHP

Cartweaver Step-by-Step

Working with Products


Cartweaver uses a traditional brick and mortar style Product/SKU configuration. For each distinct version of a product you must have a unique SKU to represent that product. The best way to illustrate the Product/SKU relationship is with a real-world example. Lets assume that your store sells Levi's 501 Blues blue jeans. This is a specific product although there may be many variations of size and color. The product could have a product ID of 501 or another unique identifier. The Product ID identifies the Product in the database as Levi's 501 Blues. Because you may have several sizes of 501s, the SKU would need to denote the size and style, such as 36x30 Stonewashed. The SKU for such a product could be 3630SW, where 36 is the waist, 30 is the length and SW represents Stonewashed. A retailer may have 40 Levi's 501 Blues in stock but only 4 of them are size 36x30 Stonewashedwhich is one reason why tracking products by SKU is important. The important thing to remember is that a SKU identifies the product's properties and must be unique in the database. You may use numbers or letters for a SKU value. Here is a visual representation of the relationship between Product IDs and SKUs as previously described.
Product ID 501 SKUs 501-3630SW 501-3632SW 501-3634SW 501-3636SW

The Product ID is how merchandise is grouped and identified. When adding items to a cart, it is SKUs that are counted for tracking inventory. Tip
One method used to help ensure that SKUs are unique is to use the product ID followed by a dash then the SKU. Once your company and shipping settings are complete you can then begin creating product options, categories and the actual products themselves.

Defining Product Options


In order to define unique SKUs, you should begin by defining product options. Returning to the Levis 501 example, product option groups could be Waist (32, 34, 36, etc.), Inseam (32, 34, 36, etc) and Wash (Faded, Stonewashed, etc). You can customize the sort order for options inside each option group to ensure they are displayed in the proper order in your store; options are sorted numerically then alphabetically. If you used sizes such as Small, Medium, Large and X-Large, you can use the sort field to ensure theyre displayed in the correct order. The Option architecture is one of the most powerful features of Cartweaver. There can be an unlimited number of options.
40

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Adding Option Groups To add an Option Group you click the Add New link under the Option tab on the Cartweaver Admin menu. This will take you to a simple form that will allow you to add the Option Name. Adding Options Once you have added an Option Group, click on the group name in the Options tab of the Admin menu to open the Options Administration page. Here you can add and administer options to be listed under this particular option group. Administering Options If there are products associated with a given option you will not be able to delete the option. Instead, you can Archive the option so it will no longer appear on the web or in the selection fields on the Product Admin page. Archiving options that have already been used allows you to keep historical data accurate, while providing a means to exclude items from view without permanently deleting them.

Managing Products
Begin adding new products by choosing Products> Add Product. When you click the Add Product link you will see that product configuration starts with three tabs: General Info, Descriptions, and Photos. Additional tabs for SKUs and Up-Sell products appear once you have created a base product. Note
Remember that every product in the database must have at least one SKU in order for it to be displayed on your store. You must first establish a product before adding its SKUs.

General Info
Basic product information is configured in the General Info tab. The product ID and name are required fields. If you need to add a product but are not ready for it to appear on the web, set the On Web setting to No. (This will hide the product and all its related SKUs from the web until you are ready for it to be shown online.)

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

41

Cartweaver 3 PHP

Cartweaver Step-by-Step

Descriptions
The short description (used in the search results page) and the long description (used in the product details page) are configurable in the Descriptions tab. Both the short and long description fields are required.

Photos
In the Photos tab, you can select the type of product image you wish to upload, from among the different image options in Cartweaver, and you can browse to the image file on your system and select it to be uploaded. The image upload will only allow web compatible image files (.gif, .jpg, .jpeg or .png) to be uploaded. Once the image is selected and uploaded the appropriate image name field will be updated with the name of the image file that was uploaded. You should not include any path information in the store image names, as Cartweaver handles the paths automatically. See the Directory Structure and Cart Flow Map section for more information on where images are stored. There are four image sizes available: Thumbnail Displayed on the search results page Large Displayed on the product detail page Expanded Displayed in a popup window when you click on the Large image, this option can be disabled on the Display Settings page Extra small Displayed with Up-Sell products and in the shopping cart, the option to display in the shopping cart can be disabled on the Display Settings page

After you complete the General Info, Descriptions and Photos tabs, click Finish to add the initial product data to the database. The Product Admin page will reload with the newly added product, and two additional tabs: SKUs and Upsell.

SKUs
Once the product has been created, the Add SKUs form will be available in the SKUs tab. You can add as many SKUs as you would like. If you wish to add more SKUs at any time simply click the SKUs tab to show the Add SKU form again. When adding SKUs be sure to complete all fields. If weight is unimportant for your SKU enter 0; all fields must be complete. Deleting Products and SKUs If you delete a product, all SKUs will be deleted too. If there are orders related to a SKU, you cannot delete the product, but you can choose to archive it. This will remove it from the web and remove it from the Active products list.
42

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

Delete SKUs by clicking the trashcan next to the SKU's ID. You may not delete SKUs that have orders associated with them. If you cannot delete the SKU and wish to make it unavailable for sale you can set the On Web setting to No.

Up-Sell
Up-Sell products are products that the buyer of the current product may find of interest. You can add as many of these as you wish. If Show Up-Sell is set to Yes on the Display Settings page, links to the Up-Sell products will appear on the Details Page in your Cart. Adjacent to the Up-Sell link is the optional extra small image, whose setting can be disabled in the Display Settings page.

Discounts
Discounts can be configured for individual products, individual skus, or for a global discount on all products. Additionally, discounts can be tied into a promotional code, which can be set up by a store administrator. All discount functionality starts in the Cartweaver admin area, from the Discounts menu in the left column. Discounted prices show in the cart on the results page, on the details page, and in the cart. If a promotional code is required to enable a particular discount, it will show up only after the promotional code is entered when checking out.

Configuring Discounts
Before adding discounts, you can configure the overall appearance of discounts in the cart using Store Settings > Discount Settings. There are three settings to be concerned with: Enable Discounts Turns discounts on and off for the entire store. Display Line Item Discount Gives you the ability to show discounts on each item as a separate column in the cart. If this is turned off, discounts are shown next to the regular price. The regular price will have a strike-through if line item discounts are not used. The strike-through style (.oldprice) can be set up or changed in the cartweaver.css and can be modified to your liking. Display Discount Notes on Cart Gives you the option to show the notes that are set up with each individual discount. If this option is checked, an asterisk will be displayed next to the price, and a note shown at the bottom of the page on all pages that show discounts.

Adding Discounts
To add a new discount, click the Add Discount link in the Discounts menu. The Discount Details form will be shown, allowing you to configure the new discount.
43

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Cartweaver 3 PHP

Cartweaver Step-by-Step

The discount requires a Reference ID, a User Friendly Name, a start date, an end date, and an amount/percentage of discount. Be careful when creating discounts using amounts. Amount-driven discounts should not be greater than the price of the product that they can be applied to. Dates can be chosen using the date popup. An optional promotional code can be defined that will be required to be entered by the user in order to receive the discount. If no promotional code is given, the discount applies to the store showing in the results and details page. After adding the discount, you can choose to limit the discount to specific products/SKUs or to allow the discount to be applied to everything. Discounts are applied to all products by default. If you choose to apply the discount to specific products, click the Add Products link to bring up the product form. Here you can search for products and SKUs and add them to your discount. Finally, a checkbox marked Active allows you to turn a particular discount on and off.

44

Cartweaver by Application Dynamics Inc. 2003-2005. All rights reserved.

Vous aimerez peut-être aussi