ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
Migrating to ASP.NET
Getting Scripts to Run on a Schedule
The Top 10 ASP Links @ Microsoft.com

QUICK TIP:
Compact An Access Database File From ASP
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


BackContentsNext

Sample Stores Provided with MSCS

The basic store that we have been looking at so far wasn't much help in demonstrating the true power of MSCS's functionality. As we shall see later on, however, there is a good reason for that-the fact that this store is the blueprint that MSCS provides for developers who want to build their own sites, and therefore has to be extremely simple in its structure.

Together with MSCS, however, come a few 'sample' stores that are intended to represent closer representations of online stores created using Site Server. Keep in mind that these are not real online stores, and therefore still miss a lot of elements that a real site should have, such as order processing and line-of-business functionality.

All the business-to-consumer sample stores require a credit card to successfully complete a purchase; even though no credit card processing actually takes place, you will need a valid credit card number. MSCS provides a few test numbers that you can use (it's always better not to use your own, because the store might be accessible to other people with whom you wouldn't necessarily want to share that kind of information), but I find it fun (and useful) to calculate some.

The algorithm used to compute a credit card number is called the Mod10 or Luhn Check Digit Algorithm. It uses the last digit of the credit card number as a checksum to verify that the number is indeed valid. It works like this:

  • Double the value of alternate digits of the primary account number beginning with the second digit from the right and working toward the left (the first number on the right is the check digit).
  • Sum the resulting digits to the remaining digits (including the check digit).
  • If the resulting sum modulo 10 results in a value of 0, the credit card number is valid.

Obviously, the algorithm can be easily reversed to calculate a credit card number. Let's take a VISA card, for example, which always starts with the digit 4 and has either thirteen or sixteen digits in total. The second, third and fourth digits from the left identify the issuing institution-we'll use 000, which shouldn't correspond to any existing bank. The remaining eight or eleven digits (excluding the check digit) are the account number (you can use any number you want). In our case, we'll choose a sixteen-digit card:

Applying the reverse Luhn algorithm to this sequence of number we find the following:

We'll then sum all the resulting values:

Now, the one digit that added to 53 would make the total perfectly divisible by ten (and therefore the result of the modulo 10 operation zero) is 7. With that digit appended at the end, the credit card number is complete:

4000 1234 5678 9017

Try it by yourselves, and you'll find out that MSCS will accept it, even though it won't accept the same number ending in 6 or 8.

A word of caution: the numbers that we have just generated do not correspond to real credit card numbers; therefore, although MSCS's sample stores will accept them because they are not linked with the credit card processing circuit, they will not be accepted by any real store. Credit card fraud is a serious crime, and using a fake number will, in the best of causes, be source of a lot of embarrassment!

The Simplest Sample:Clocktower

Let's now move on to examining the sample stores that are provided with MSCS. We'll proceed in order of complexity, with the simplest store first and more complex ones to follow. The first site on the list will have to be Clocktower, a fictitious online store that sells clocks.

Clocktower shows the most basic functionality provided by MSCS, and is in fact very close to the 'unbranded' store that we have used for visuals so far. You can access the store through the following URL:

http://your_host/clocktower

where your_host is the name or IP address of your computer (depending on how you set up your installation of IIS).

You will only be able to see the Clocktower store if you have correctly installed MSCS and Site Server. The samples are installed as part of the setup process for Disk 2 of Site Server, Commerce Edition.
Clocktower's Home Page

As you can see from the screenshot, the home page for Clocktower can be divided into three different areas, each one designed to fit a specific purpose:

  • The header
    This section's task is to provide links to the main sections of the site. Because Clocktower is a very basic site, the sections presented are exactly the same as those that are part of the standard store we looked at earlier. As a matter of fact, the header serves the same purpose as the navigation bar that was on the left side of that store's pages. You might find it strange that the home page contains a link to itself (Lobby), but you should keep in mind that those links are supposed to be consistent throughout the site.
  • The body
    The actual content of the home page is shown in this section. Clocktower's designer has decided to include in it a brief description of what the site offers and a list of the available departments. Comparing this home page with the one that we saw for the unbranded store, you'll probably notice a certain amount of similarities. Actually, to be honest, the format of the two pages is exactly the same (including the generic description text)!
  • The footer
    Finally, the last portion of the screen is dedicated to the usual legal disclaimers and notices. The idea here is to bring a sense of closure to the page; other online stores sometimes take advantage of this space to provide useful links, such as one to the Customer Support section of the store, or to provide text versions of the images shown in the rest of the page for text-only browsers.
As we already mentioned, Clocktower is fundamentally a branded version of the basic MSCS store that we examined earlier in the chapter (there are actually a few differences that we'll see in a moment). It is important, however, to understand how the three elements of the page are divided, because this structure is maintained throughout the entire site. From a technical point of view, as we'll see later on in the book, this corresponds to creating a standard header and footer and then including them in every page using server-side includes:

<!--#INCLUDE FILE="i_header.asp"-->

Body section goes here

<!--#INCLUDE FILE="i_footer.asp"-->

The file i_header.asp contains not only the common elements that are part of the header, but also all the HTML code that is needed to initialize the page, such as the TITLE and HEAD tags, any style sheet declaration, common ASP functions, and so on.

Knowing More About Clocktower

Clickin on the About icon in the home page's header (or any other page's, for that matter), we'll be directed to the page in the following screenshot. As you can see, this page maintains the consistent look and feel of the home page, as we predicted in the previous paragraph, and offers a substantially shortened description of what the store does.

In a real-life store (we'll see how the other samples are a little better at demonstrating this), this would an important part of the site, albeit not one essential to the purchasing of goods itself. In fact, the Internet being such an anonymous medium, it's difficult for a user to really trust a store that doesn't provide a lot of information regarding itself-what the policies are, what kind of services the site provides, and who the people behind it are. If you look at many online stores, especially the most popular ones, they do offer a lot of information aimed at making the customer more confident that buying from the site is a safe and good proposition.

Browsing Through the Store

If we click on any of the departments shown on the home page, we are taken to the department page shown in the adjacent screenshot. The layout is, once more, very simple and straightforward: all the products that belong to the department that we selected are displayed in a simple list that includes their name and manufacturer.

In a real-life store, you would probably include some more data, and possibly provide a direct link to the shopping basket page, so that those users who already know the product they want to buy are not forced into the annoying process of having to go through the product page to do so.

Speaking of the product page, there is one for you to see in this screenshot. This time, because the nature of the products is realistic, you can get a better idea of what the page does. As you can see, the focal elements of the page are a picture of the object (very important in an online store, where the user can't examine the object closely) and a description of it.

Browsing a little through the site, you will notice that all the product pages look the same (and are actually generated by the same ASP script). This is, obviously, a consequence of the fact that all the products are stored in a database, and therefore the pages are displayed using a pre-determined template filled in with the appropriate information. To avoid making your store too "flat" (but without compromising its consistency), it's a good idea to think of ways through which you can customize each page, like, for example, using a slightly different template depending on the department that the product belongs to.

Basket and Ordering Process

The basket page is exactly the same as the one we saw before, although the design is different for obvious reasons. When we are satisfied with its contents, we can proceed to the purchase process. The first step asks us to provide a shipping and a billing address. In this case, the Microsoft Wallet is not even mentioned, and the format is slightly different from the one that we saw in the basic store. There is no specific reason why you should decide to use this method rather than the other, so I suppose that the reason why Clocktower works this way is that whoever designed it wanted to provide a viable alternative to the standard procedure.

It's probably worth noticing that this approach doesn't necessarily simplify the process. As a matter of fact, the customer will still have to go through two different pages to complete the purchase, so no time is saved and, if anything, the user might end up being a little confused about why there are two screens. At the same time, though, the fact that the user is given the opportunity of specifying just one address and then use it both as the shipping and billing destination (by selecting the Same as Shipping Address checkbox) can speed up things and provide a more pleasant experience.

The next page in the sequence provides a summary of the order (which is now possible, since we know where the merchandise is going and we can calculate shipping and taxes appropriately) and requests some credit card data. If all the information entered is correct, we'll end up to the page shown in the following screenshot, which advises us that our order was successful and that we'll have to write down a 26-character long number if we want to keep a record of our purchase.

If you make any mistakes along the way, Clocktower will promptly notify you with an error page and advise you on how you can fix the problem. It's interesting to notice that the page's background color changes from green to your default window background color (light blue in my case). It's difficult to tell whether this is just a coincidence or something intentional, but it might be a good idea to attract the user's attention.

Volcano Coffee

The second sample store that we'll examine is called Volcano Coffee (VC) and is a fictitious online site that sells, as the name suggests, coffee and the related paraphernalia. VC is the one store that offers a good balance between its credibility-which makes it good enough to adapt easily to a real-life situation-and its simplicity, which allows us as developers to examine it easily from a technical point of view.

VC is also very important because the MSCS team has improved its functionality significantly and used it for performance tests after the release of SSCE3. A new version of VC, called VCTurbo, was released to the public toward the end of 1998, and is available from the Site Server site at http://www.microsoft.com/commerce. It includes several enhancements, most of which are aimed at improving the efficiency of the store as a whole and of the purchase process in particular.

To access the copy of VC that resides on your server, go to the following URL:

http://your_host/vc30

where, as usual, your_host is the name or IP address of your computer. It is worth noting that the name of the virtual directory where the site is stored is called vc30 because Site Server, Enterprise Edition 2.0 contained a previous version of the store. If you have the older Microsoft software, comparing the way VC works in it with the new one is an interesting exercise that will help you understand the differences between the two versions of Site Server.

Volcano Coffee's Main Page

Upon entering the store, the first thing that you will probably notice is that this store's design has much more personality than Clocktower's. Another interesting feature of the main page is that it only works as a gateway to the store, and offers no functionality by itself. The reason for this is that, contrary to the previous examples, VC does not allow its customers to browse the store anonymously.

As a result, you can only enter the store if you are registered customer. Therefore, the first thing that we must do as soon as we open the home page is to either login or register as a new user. The validity of this approach to online shopping has been the focus of a lot of discussion. Some people, including myself, believe that doing so can be compared to asking people entering a retail mall for their ID-although of course it would be impossible to accomplish anything like that in a practical way, whereas there isn't really any technical problem in doing it online.

However, there are some advantages in asking people who they are from the very beginning. Most notably, the customer enjoys a higher degree of security-the data that he or she communicates to the store is persisted by means of a login procedure and not using a cookie-while the online store owner is able to collect more information right away and use it to provide a better shopping experience. In addition, the store's contents can be customized according to the user's geographical location, for example, or according to other similar parameters.

Ultimately, I think that you should let your customer decide whether they want to shop anonymously or not, explaining to them advantages and disadvantages of both approaches, and noting that, should they decide to make a purchase, they will eventually have to reveal their identities anyway.

The registration procedure, shown in the next screenshot, asks only a few questions of the user; as you can see, these are completely unrelated to the billing data-the rationale being that it's always a good idea not make such data available unless significant security measures are in place (and they aren't here). Returning users can instead use the login page, which only asks for a username-the e-mail address is used here-and password.

The "Other" Home Page

Once a user has logged in to the site, he or she will be shown the page in the next screenshot, which can be considered the real home page of the store. VC takes a different approach to displaying the catalogue of products that offers a more ordered approach to purchasing but adds one more step in the process.

As you can notice, this time the home page does not include any product or category directly. The left side of the screen is reserved for the common navigational elements, the Store Directory replacing the Lobby, and its body provides some generic information about the store in addition to a link to the Store Directory and another one to the Products Page.

Browsing the Store

The Store Directory is fundamentally the same as the Lobby home page in Clocktower: it offers a list of the departments available from which the user can then view a list of products. The only substantial difference, in this case, is in the fact that the departments are organized in a multi-level hierarchy in which only the lowest level categories have products in them.

The Products Page, on the other hand, is basically an expanded version of the Store Directory in which the list of departments also contains the products. From there, it's possible to navigate directly to the Products Page. It's good to keep in mind that this kind of listing works only because VC contains a very limited number of products. If you are planning to go online with thousands of items, this approach won't work for you.

Contrary to the stores that we have examined so far, VC sells a range of products that includes very different items, such as coffee and shirts. Therefore, there is the need to present the products in a different way, and provide support for the fact that certain attributes have to be specified for some of them. If the user wants to purchase a coffee mug (as in the preceding screenshot), for example, he or she will have to specify a size and a color; these specifications, however, do not necessarily apply to a pack of coffee (see the next screenshot). In addition, the store has to be able to handle the fact that some of these attributes might modify the merchandise's price or catalogue number.

Search Funtionality

Product search in VC is, as was the case in other samples that we have seen so far, not one of this store's strong points. In fact, the only option that the user has is to have the store perform a keyword search based on some text that he or she inserts in the text box provided.

The solution that has been used in this case consists, obviously, of a simple SQL query in which the user&39;s input is turned into a parameter for a like search:

Select * from products where name like:'%:1%'

If you actually attempt to browse through the store for a while, you'll find that this approach works quite well, although you will easily run up against its limitations if you're not really sure about what you're looking for. But then again, the number of products is very limited, and we can hardly argue that people would be looking for anything but coffee.

Buying From Volcano Coffee

VC's purchase process is similar to the one that we have seen in the basic store that we examined at the beginning of the chapter. Thanks to the fact that we were forced to login at the beginning, the store is automatically able to fill most of the required fields for us, and that's a pleasant surprise, especially if we are returning customers.

Once the process is complete, the usual confirmation page is returned to the user. This time, however, the order number is a link that redirects the customer to a tracking page where he or she can, at any time, review the purchase made. Although this page is not particularly useful as it is (sure, people can be forgetful, but then how are they going to remember that long order number?), it can be expanded to provide additional information. For example, if the store were integrated with a line-of-business system, the inventory status of the items ordered, together with the status of the actual shipment, could be displayed, giving the user a sense of what's happening to the products he or she bought. If you are lucky enough to interface with a courier who provides you with waybill numbers that you can verify online, you could even provide a link to the courier's web site and let users track the status of their shipments.

Volcano Coffee's Store Manager

VC's Store Manager interface differs in only two ways from the basic one that we saw earlier in this chapter. First of all, it provides a means to examine the database of shoppers who have visited or purchased from the site. This interface can be used as a powerful customer support tool, although a higher number of users than ten would probably require some improvement, such as a search function.

The presence of a banner ad is what probably caught your attention first, though. Granted, it's kind of absurd to have advertisement in the Manager of a site, which is only supposed to be visited by authorized users who won't really have much propensity for clicking on it, but let's not forget that this is, after all, a sample site. The ad's real goal is that of showing yet another part of Site Server 3 functionality, called Buy Now.

Buy Now makes it possible to create banner ads from which the user can purchase merchandise without leaving the site he or she is currently in. In fact, clicking on the ad brings up a new window (as we can see in the next screenshot) from which it's possible to purchase the merchandise directly in four steps (product selection, shipping, billing and purchase confirmation). Once the process is complete, the pop-up window is closed and the user is once again in the original web site.

There are a few interesting advantages to using Buy Now. First, the user is directed to the purchase process right away rather than having to go through the entire site. This provides a much more targeted advertising approach. Second, the originating site will not lose a customer, which might get the Buy Now store's owner a better deal on online advertising. At the same time, the Buy Now store's owner will have acquired the customer anyway, and will be able to invite him to the store through other methods (i.e. a special offer notice delivered by e-mail).

The Microsoft Press Sample Store

For all of you out there who think that Amazon deserves a lesson, here is a chance to get a jumpstart on your world domination pet projects. The Microsoft Press sample store is a fictitious site that sells books published from Microsoft Press. The real MSPress web site doesn't have an online store, but fulfills orders through a third-party.

To access this sample, use the following URL:

http://your_host/mspress30

MSPress presents a number of unique challenges. For one thing, it offers more than 100 different products. Even though all of them belong to a homogeneous category (books)-and therefore don't present the problem of having to handle products of different kinds-their number alone makes most of the search and display techniques seen so far unusable.

With so many products on the table, in fact, it's difficult to simply offer a one-page listing-most users won't be able to find anything by just browsing in it. Also, technical books are seldom searched for by keywords in the title (can you name more than three classics-with the exception of this one, of course-in the computer books category?), but rather by topic or by author.

Looking For A Book?

As you can see from the next screenshot, there are a few ways to browse the store. View By Subject corresponds to receiving a list of the departments into which the products are divided, and then starting the drill down from there. This approach is already quite difficult for the user to follow because there are many categories in the store. View by Author provides an alphabetical list of all the authors featured in the site; this approach is well organized, and it would be easy to find a book knowing its author-if that was the way that most people search for books. However, if you're so unlucky that the author you're looking for has a name that starts with the letter Y, you will have to scroll down quite a bit before you'll be able to find the titles you're interested in.

View By Title offers an improved approach to displaying a long list of products. The listing is divided into pages that contain only a limited number of products. It's still somehow difficult to find a title, especially if it's toward the end of the list (which is sorted alphabetically), but at least the user won't have to wait long for the page to load.

The Hot Off The Press section provides an interesting approach to displaying newly released books. As you can see, the page offers only a few selected titles and displays them together with a picture and a one-line description. The result is quite enjoyable for the user, who might as well make a purchase decision right there. If you take a look at the hot_off_the_press.asp file, which is used to generate this screen, you will notice that the entire page is completely dynamic and responds in real-time to changes in the book database. The list of books is obtained by executing a simple query against the product table:

<% cmdTemp.CommandText = "select sku, isbn, title, subtitle, date_published,
list_price from mspress30_product where date_published > {ts '"& new_date &'"}
order by date_published" %>

The search functionality offered by MSPress is much more evolved than the one offered by the stores that we have examined so far. This time, there is much more than a simple text box in which the user can type in one or more keywords, and a complete range of options are provided. The whole operation still results in the execution of a SQL query, and a simple one to say the truth, but the user has much more control over how the products are searched for.

Data Caching

Having a dynamic web site is definitely an advantage these days-you can better organize your data and write pages that respond in real-time to any changes to the database. The downside of this approach is in the fact that, if your data doesn't change very often, your pages will continuously hit the database essentially for no really good reason.

A possible solution to this problem could be to create a recordset as part of the store initialization in the global.asa file and keep it in the Application intrinsic object, which is available to any page in the store. However, using a recordset is not necessarily a good idea, because they are still linked to the database and force a connection to remain open to your SQL Server.

MSPress solves this problem, caused by the nature of the View By Author page, by creating a variable of type Dictionary that holds all the data that needs to be displayed and saving it in the Application object. We'll take a better look at the Dictionary component later on, but for the moment you can consider it similar to the Scripting.Dictionary object that comes with IIS; as a matter of fact, it can be used to store an arbitrary amount of data in a structured format.

When the page needs to be displayed, the author_list.asp file retrieves the data from the Dictionary object instead of hitting the database. The performance of the store increases significantly thanks to this relatively simple improvement, and the only inconvenience that it causes is in the fact that if we update either the author or product database the changes will not be reflected in the page until we force the site's IIS application to reload. This can be done manually as part of normal IIS management procedures, or by closing and opening the store, or even automatically (for example in response to the editing of an existing product or insertion of a new one) by editing the global.asa file and simply adding an empty line (This forces the current Application to end and triggers the application_onstart event handler, reinitializing the program).

The Product Page and Historical Cross-Selling

Either through one of the product lists or by making a search, you will eventually end up in the product page, shown in this screenshot. MSPress offers a more streamlined design than its predecessors in this chapter, and the information presented is more complete and better organized (not to mention more realistic!).

What really should be noted about this page, however, is the last part-the one that begins with the sentence "Other people who have bought this book have also purchased the following titles". This section makes use of Site Server's historical cross-selling functionality and, as you can see, the result is pretty interesting.

Naturally, the information that is loaded as part of the installation procedure for the sample store is completely fictitious, but in a real store it would actually represent the habits of real people and there is a good chance that it would entice other people to buy other books based on the preferences of others who already purchased goods from the store.

The Purchase Process

MSPress' purchase process is very similar to the one offered by VC, and in fact the store asks new users to register while giving returning customers a chance to login to the site to expedite the procedure. Since VC does not provide any order tracking feature to its users, login is only required at this stage and is used exclusively to make the purchase process faster.

You will also notice that the historical cross-selling functionality included in the product pages is also offered in the basket page, with the intent of providing the customer with one more chance to buy additional titles' on impulse'

MS Press' Store Manager

Let's take a quick look at the store management functions provided by MSPress (see the next screenshot). As you can see, we are already familiar with most of the concepts that are presented here. Authors and subjects replace the departments that we have seen so far in the other stores, and simply represent two different ways of organizing the store.

The only section that we should examine a little more in detail is the one that is accessible by clicking on the Balance Search by title Pages button. In order to grasp what its goal is, we have to examine the page that lets us view all the products stored in the database and understand how it works.

If you take a look at the title_list.asp file, you will see that it makes reference to a table called mspress30_title_index. Each record in that table represents the bounds of a chunk of data in the product database, which in turn corresponds to the content of an individual page that is shown to the user in the storefront.

Whenever a user requests to see part of the product listing, the script determines what chunk should be delivered to him or her and extracts the appropriate records from the product database:

The result of this operation is that the script only extracts from the database those records that it effectively needs to display, and therefore reduces both the amount of data that has to be transferred from the database server and the computation time that is required to extract it.

Obviously, the records in the index table should be calibrated so that each chunk of data contains approximately the same number of entries, which is exactly what the Balance Search by title Pages section does. This operation should be repeated periodically, because the addition, removal or editing of any of the titles in the product database will cause the pages to become uneven.

Trey Research: Not Your Average Store

The last sample store that we'll be looking at is called Trey Research (TR). Contrary to the other samples that we've examined so far, TR doesn't sell any physical goods, but it deals in digital information, in particular trade reports. You can access it by typing in the following URL:

http://your_host:5293/tr

The number 5293, which is separated from the hostname by a colon, indicates that the web browser should try to access the site not through the normal TCP/IP port dedicated to HTTP connections, but rather through port number 5293.

It is important that you use the http:// prefix when typing the URL into your browser, because otherwise the browser will not know what protocol to use when accessing the site, and you will most likely receive an error of some sort.

The reason why we have to go to a different port number in order to get access to TR is that the store interfaces with the Personalization and Membership functionality of SSCE3 and, in order to have its own Membership Directory, it is required to reside on an instance of IIS of its own. As a matter of fact, if you open your Microsoft Management Console and take a look at the IIS configuration, you will notice the presence of a server instance called Site Server Commerce Membership Samples Web Site that contains the virtual folder tr. Obviously, this also means that, unless you have P&M; installed on your server, you will not be able to view TR.

The Home Page and Login Procedures

Trey Research's home page (visible in the next screenshot) only contains some summary information about the site. Any of the links offered bring us to a login screen that will ask us to either enter our username and password or to register as a new user. The information collected as part of the registration procedure, and the profile that is consequently created, are stored in the Membership Directory, against which they are checked afterwards. As you can from the following snippet of code, extracted from the file verifpwd.asp, this is a very simple process:

After the VerifyCredentials method of the Membership.verifusr.1 object is executed, an error indicates either that the user data is invalid or that the user doesn't have permission to view the page he or she is requesting

You can take a look at the users that have registered with your instance of TR by going to the administration part of Site Server, which you will find at the following URL:

http://your_host/siteserver/admin

Click on Membership Directory Manager, then on Users, and finally on Select Server. From the resulting page, you should choose Commerce Membership Server and then enter the following login data:

Username: tradmin
Password: password

This will take you again to the main administration page, from which you can select Users and then User Management. The resulting page contains a list of all the users similar to the one shown in the next screenshot. As you can see, you can view and edit a user's properties, add a new user or delete an existing one and assign different users to the available groups. In this case, all users are by default members of the tr group, which gives them access to the entire site, while those customers who have purchased one or more case studies from the store are given time-limited access to the studies group, and so on for the other products sold.

Navigating the Store

TR's store navigation is somewhat similar to the others that we have seen so far. The user is asked to choose one or more document categories, access to which can be purchased in different ways (i.e. one month, three months, and so forth). The options chosen by the user are added to the basket and can be purchased in the traditional way. In addition, TR also lets each user purchase access to the information without specifying a payment option. In that case, a record is entered into a database table that can be used later to produce invoices and bill the customer.

In a real online store, you will probably want to implement this payment system in a different way, as it effectively corresponds to giving credit to your customers, something that you should be very careful about. You could, for example, apply some rule designed to limit any potential fraudulent use of the store, such as allowing billing as an option only to returning customers or to accounts that are specially marked with an attribute by you (and not by the users themselves!).

It's also interesting to notice that, because TR doesn't actually send its customer anything, it doesn't ask for a shipping address as part of the purchase process. However, as we shall see in the next few chapters, the system is actually calculating the shipping costs for the purchase-and is setting them to zero-because shipping is a required part of the Order Processing Pipeline

Trey Research's Management Page

TR takes full advantage of the possibilities offered by P&M;, and uses it for regulating access to the store's manager pages as well. To find out how, let's try to open the Manager's home page, which is located at the following URL:

http://your_host:5293/tr/manager

If our browser is IE, we will be greeted by the Membership Authentication dialogue box (see the next screenshot), which will ask us to enter our login username and password (the combination tradmin/password works well here, too). Clear Text authentication is also supported from non-IE browsers.

This Manager's home page is not really too different from the others that we have seen so far. As you can see, the store is based on the concept of an article, the basic piece of information to which the user receives access. Articles are grouped in categories, which in turn are organized by provider. Finally, the terms according to which the user is granted the permission to view the articles are expressed as individual products in the database. For example, product 01 represents the right to access the category case studies for the duration of one month.

Since the whole site interfaces with P&M;, it is interesting to see how the Shoppers and Subscriptions lists are generated. In fact, you will notice that all the lists are generated by the same script, which is a combination of three files:

If you look at the last two files, you will find out that in reality they are simply long case statements designed to handle every possible scenario in the proper way. This ensures that the body of the list generation can be reused each time and that they can be modified by only changing one single file.

The file list.asp, as we said, does most of the work. The only problem that it faces is that, while just about all the queries use standard database access, those that have to do with the users and their subscriptions have to go through the P&M; interface, which works through an OLE DB provider which is not ODBC-compatible. The script takes care of this problem by using a different initialization method depending on the value of the variable mem_ds (which obviously stands for data source and membership):

As you can see, if the value of mem_ds is True, the script proceeds to setting up an OLE DB connection for interfacing with P&M.; Otherwise, a normal ODBC connection is created.


BackContentsNext
©1999 Wrox Press Limited, US and UK.
Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers