The Web store Web appication is made up of several important pieces:
- The wwStore business objects
- The WebStore Web Connection Server application
- wwStore HTML template pages
These pieces are wound together using standard Web Connection application strategies through a project that is generated through Web Connection's New Project Wizard. As such the store runs as follows:
- .wws ScriptMap
It uses a .wws scriptmap for all pages which means the store has pages such as Default.wws, item.wws, shoppingcart.wws, orderform.wws and so on. These map to Web Connection process methods which in turn load HTML templates. - wwStore Web Connection Process Class
Each of these requests is routed into a Process class and matching method. Default.wws goes to wwStore::Default(), item.wws to wwStore::Item() and so on. - Business objects do the work
The store is heavily based on the wwBusiness object subclasses that handle all data access and logic of manipulating the shopping cart, user profiles and orders. The wwStore process class never (with the exception of a couple of maintanence requests) accesses tables directly and all interaction happens through these business objects. The key object is the Invoice object which acts as a composite object to the customer and lineitems that make up the total order. - HTML templates handle the display
All HTML output is generated through HTML templates that are stored in the Web directory. Each request has its own page, so default.wws, fires the wwStore::default() method, then renders the default.wws template. The templates include some boilerplate HTML and dynamic content that display the toolbar and basic table layout of each form in the store with a main section displaying the custom content. The majority of content displayed is bound directly to the business objects. You'll see a lot of templates accessing <%= oInv.oData.OrderTotal %> and <%= oCust.oData.LastName %>. Two special pages - Header.wws and LeftSideBar.wws - are loaded into each of the main pages as sub-components to provide simple customization of the basic layout.
To review: Requests for a page like item.wws hits, the wwStore::item() method which uses business objects to perform the data processing, then uses the item.wws template to display the data.
Cookies and Sessions
The Web Store uses cookies to track users through the site. Web Connection Sessions are used to store user identity information such as generated invoice and customer PKs until orders are actually submitted. If the browser doesn't accept cookies or the user decides to refuse the cookie this application will not work. It can be modified fairly easily by using license plate IDs on Web pages to identify users, but it will require a lot of search and replace to add IDs into every linked URL.
Users are tracked through the cookie which links back into the user's customer 'profile'. The profile in the Web Store is really just the master customer record which contains all of the user's contact info. This information is then used to remember the user when he returns to set defaults for the name, country and all of the contact info so it doesn't have to be re-entered each time.
The Configuration Object
The store requires a number of configuration features which are handled through a standard Web Connection wwConfig object which is stored in your application's INI file (WebStore.ini by default). The wwStore process class automatically assigns the wwstore config object to a PRIVATE variable called config for easy access so you can access any store configuration values simple with Config.cAdminUser for example.
[Wwstore]
Datapath=.\wwStore\
Htmlpagepath=d:\westwind\wwStore\
Adminuser=Any
Secureorderpage=On
XMLDocRoot=wwstore
CookieName=WESTWINDUSER
AdminUser=jdoe,mfry
Storename=West Wind Technologies
Mailfrom=West Wind Technologies
Mailfromemail=sales@west-wind.com
Mailserver=mail.server.net
Mailcc=another@email.com
Banneralias=wwSitebanners
Bannerfile=wwSitebanners
Most of these values should look familiar to you. Important ones include:
HTMLPagePath
This points at the wwStore Web directory so the store can find the HTML templates. This is used in calls to ExpandTemplate(Config.cHTMLPagePage + "default.wws").
AdminUser
The user(s) that'll be allowed access to admin functionality. Use a single username, a comma delimited list, or ANY for any NT account, WCINI for the settings out wc.ini or leave it blank for no authentication. Note: On Windows 98 you probably have to leave this value blank since Basic Authentication is difficult to get to work on Windows 98.
SecureOrderPage
This is an important setting that determines whether the order page goes into secure mode. When you click on Place this Order this flag determines whether an HTTPS link or plain HTTP is used. Your orders should ALWAYS be secure, but this flag is here to allow you to easily test the application on a server that may not have a secure certificate installed.
CookieName
Determines the name of the single Cookie that is created to track users. The cookie is permanent and stored on the users computer unless refused. The cookie is used to reattach the user to his profile when he returns to the store another day.
XMLDocRoot
Determines the doc root name for your store application for all automatically generated XML. This is mainly for consistency and allows you to customize the XML to your implementation.
BannerFile and BannerAlias
The default store uses the wwBanner class to provide rotating banners for some of the products in the store. These values specify the name of the file and alias for the file. This is mainly to allow multiple banner files to co-exist.
XML capabilities
The store is XML enabled to an extent. Most links are capability of returning XML directly and this is provided through the nResultMode property which checks for a querystring value of &display=XML. When this is present the Web store returns data for many operations in XML format. For example to return XML for an item you'd use:
items.wws?sku=WCONNECT&display=XML. It works for itemlists, items, your shopping cart and the final invoice.
Several of the adminstration features also allow you to download data generically in XML format. The offline viewer pulls all data from the site in XML format as well. It can also upload data to the Site with XML. XML functionality is generically implemented using the ReturnObjectXML and ReturnCursorXML methods of the wwStore process class which can return any result data into XML quickly.
Administration Features
All administration functions in the wwStore class are name Maint<function>. You can see the various requests by going to the store administration page at /wwstore/admin/. You can view orders placed and access data in XML format to capture the data. You can also view and edit inventory online.
All of the Admin functions force login with a small snippet of code:
IF !THIS.Login(Config.cAdminUser)
RETURN
ENDIF