Getting Started with Microsoft Merchant Server

Dynamic Web pages let you easily build a shopping experience for customers at your online store.

J. Simon Hancock

May 31, 1997

14 Min Read
ITPro Today logo in a gray background | ITPro Today

Doing business on the Internet is tricky. To keep up with the competition, you need an onlinestore displayed in attention-grabbing Web pages. You need to continually update product informationat minimal cost and with little down time. You need a secure payment system. To do all these thingsand more, Microsoft offers Merchant Server.

Merchant Server is a complete system for doing business on the Internet with flair. MerchantServer is a Windows NT Server-based management product that lets you create compelling Web sites formarketing products and use a relational database to offer personalized service. Although MerchantServer does not magically create an online store overnight, it offers example stores to help you setup your site quickly and easily. Let's look at some of Merchant Server's advantages, its components,setup and installation, the included example stores, and a Web page designed with Merchant Server'sdirectives.

The Merchant Server Store
Merchant Server lets you create a responsive online store for your company. It offers aconvenient shopping experience for your customers and a secure credit card payment system. One ofMerchant Server's greatest advantages to sellers is its ability to target customers. MerchantServer's extensive order tracking system lets you offer special bargains to your customers based ontheir past purchases, and suggest items related to your customers' current purchases (cross-selling)or suggest similar items of better quality (up-selling). For example, if someone buys a hard disk,you can suggest other items needed to install it--a Y power cable, extra ribbon cables, and soforth. Because you can develop customer profiles, you can target specific markets for sales or othermarketing efforts. Merchant Server has several other attractive features:

  • Secure transactions--You can assure customers that the information they send is privatebecause Merchant Server uses the Secure Sockets Layer (SSL) channel encryption and SecureTransaction Technology (STT) to protect credit card information.

  • Support for Java and ActiveX technology--You can take advantage of today's technology. Forexample, you can use Merchant Server's Page Generator (pgen) features to combine several Web pagesinto one.

  • Multiple stores on a single server--You can develop a virtual shopping mall by leasing spaceto smaller companies that can't afford Merchant Server and the equipment to run it.

  • Scalable and extensible--You can keep the store on one server or distribute it over severalservers to provide load balancing for heavy hitters. Like most other Microsoft products, MerchantServer is extensible through Open API. This API is valuable for integrating Merchant Server within-house systems (such as inventory fulfillment) and other software vendor components.

  • Instant changes--You can change information dynamically so that price changes in the databaseare online instantly, without rebooting the system. You can create sales and promotional offers onthe fly.

  • Flexible data schema--You can reference your products from various formats, such as MicrosoftWord or Microsoft Excel. You can generate product pages from your existing database.

  • Open data interfaces--You can access product information from current databases via the OpenDatabase Connectivity (ODBC) standard or use a separate database for Internet products.

Microsoft doesn't tie Merchant Server's payment mechanisms to any specific online paymentsystem (such as the included software from VeriFone). Instead, Microsoft continues to work withthird-party online payment providers so you have a choice of providers. Payment provision is aseparate service; if you choose direct online payments, you need to set up a system with athird-party company and your financial institution.

Setup and Installation
To install Merchant Server, you need to be familiar with NT Server, Microsoft InternetInformation Server (IIS), relational databases and database management systems such as Microsoft SQLServer and ODBC, and configuration management with the Registry Editor. Merchant Server requires NTServer 3.51 or 4.0, IIS 1.0C or later, an ODBC-compliant database, 64MB of RAM, 55MB of availablehard-disk space, and TCP/IP networking protocol. If you don't install and run SQL Server duringMerchant Server setup, Merchant Server will not install the starter stores. You can install thestarter stores later, but doing everything at the same time is easier and less confusing.

Before you install Merchant Server, create a database device and a database on your SQL Serverfor each of your stores (using SQL Server Enterprise Manager) and create a data source name (DSN)for the database (using the Control Panel ODBC32 Item). Keep the data device names and DSNs simple,short, consistent, and handy.

Installations are either single server or distributed on many machines. Some distributedinstallations require additional licenses, depending on your intended use. In a multisysteminstallation, Merchant Server Setup initially installs the starter store content (templates andelement files) and the system assets (images and ActiveX controls) on the system. The assetscontain the Controller, which stores Registry information for all Merchant Server components, andthe Router, which communicates with IIS. Then systems administrators copy the content and the assetsonto the Store Server. (The Merchant Server documentation provides complete details and suggestionsfor the best ways to perform each type of installation.)

Installations are custom or complete. In a custom installation, you select only the starterstore and the merchant components that you designate. In a complete installation, you install allMerchant Server options. Complete installations are great training for beginners on developmentservers.

Installing Merchant Server is easier than installing a Microsoft Office application. You needto keep handy the names of the database devices you created for your starter stores and the DSNsyou've designated for database connectivity. Merchant Server prompts you to match the DSNs anddatabase device names to the stores. After you install Merchant Server, you can copy the starterstores and modify them to create your stores, in a fraction of the time you could create stores fromscratch. If you have space, install all the starter stores on your development server. When youcreate your production server, copy only the code you plan to publish on the Web. This code will beyour live store.

Example Stores
To save time when you design your first Merchant Server site, use one of the starter stores thatMicrosoft includes with the software. Starter stores are partly templates and partly operationalsamples that you can modify to fit your site. These example sites include Clockpeddler--a clockstore--which is a very simple store and a great site for getting started. Adventure Works--a storefor the rock climber--is a more advanced site for the intermediate to advanced Merchant siteengineer; this site gives you a good feel for the product.

Adventure Works contains many features that most businesses use in a standard department orclass-type product environment. For example, a department store has departments, such asaccessories, and the departments have classes of goods, such as hats, belts, gloves, and so on. Inthis environment, a customer selects the department, the class within the department, and specificitems within the class.

The Volcano Coffee site is more complex; it contains many robust features of HTML and theMerchant System and provides quite a challenge. The Microsoft Press Online Bookstore site isamazingly similar to the real Microsoft Press Online Store(http://www.microsoft.com/mspress/books/b.htm). Take advantage of these examples as patterns to helpyou design your store quickly.

Registry Keys
Installing Merchant Server sets certain keys in your system Registry. If you have to alter theRegistry key values that the Merchant System uses, you need to know where to find them. (See theprogram documentation for information about all the keys that Merchant Server uses.)

Store Registry keys represent the installed example stores. Open the Registry Editor (regedit),and go to an example store site. Start looking from the root keyHKEY_LOCAL_MACHINESOFTWAREMicrosoftMerchantServerStores. The next level of keys contains keysthat represent specific example stores, such as ClockPed and AdvWorks. Look under the store name youwant for the example key settings. All key settings are in the Merchant Server documentation.

You can use the ADD STORE feature of the Merchant Administrator tool (a Control Panel applet)to automatically generate a new store based on an existing store. An alternative is to manually copya store; if you do, be sure to copy (export using regedit) the Registry keys for that store startingwith the top-level key, which includes the store's name. You also need to create a DSN entry in yourNT Server's ODBC setup.

Setting Up Your First Site
Start by reading through all the documents in the Merchant Server CD-ROM, noting areas thatinterest you and then printing the code for an example site. Read through the code with thetechnical reference document handy to understand how Merchant tags are similar to and different fromHTML. Gradually replace the references to the starter store with references to your store and itsproducts. Then modify backgrounds and artwork, and jazz up the site with animation and sound.(Always make backups before you make changes--you knew that, right?)

Once you get through the example sites, you'll find Merchant-tagging (my term for writingMerchant code) a snap. As with HTML, you use tags to implement Merchant directives and commands.Unlike HTML code, which is static, Merchant tags in brackets tell pgen what to dynamically transforminto the HTML code that clients see at their browsers. Merchant tags automatically update pages whenMerchant Server retrieves new data (e.g., inventory changes).

Although tagging gets easier with practice, you can make simple mistakes. To avoid mistakes,make templates for pages that you write frequently and make element pages (such as headers, footers,or common pieces of HTML and Merchant tags) to store until you need them. Template refers toa page that Merchant processes; a template is the Merchant Server pgen source code.

Several code tags, elements, and components are important to Merchant Server and to eachMerchant site. The major components of Merchant Server include

  • The pgen component, which dynamically generates HTML pages in response to HTTP POST or GETinstructions from a browser

  • Action Manager (xt), which executes actions (such as functions) that perform tasks such asdatabase modification

  • Order Processing Component System, which handles order checking, initialization, priceadjustments, shipping, handling, taxes, payment, acceptance--anything that has to do directly withthe order

The pgen component uses directives (Merchant tags) to dynamically generate the contentof the target HTML page. (Directives are case sensitive.) For example, a directive to create a linkto another HTML page might look like
[link "newproducts.html"]Go to new Products[/link]

From that code, pgen produces an HTML line
"newproducts.html">Go to new Products

The browser client (such as Microsoft Internet Explorer) sees this code.

Directives fall into six categories: value display, for generating text for inclusion on a Webpage (e.g., [date]); conditional, for flow control (e.g., [if] [else] [/if]); convenience, forcreating value references for a later time (e.g., [include]); navigational, for navigatingthe site (e.g., [xform]); database access, for using a database (e.g., [fetchrows]--a personalfavorite); and order, product, shopper, receipt access, for transactions (e.g., [fetchorders]).These categories contain roughly 45 directives (knowing Microsoft, more are probably on the way).Some example tag lines will give you an idea of how to implement directives.

Designing a Merchant Server Page
Suppose you are writing a page to display items of a selected brand that are available from yourstore. You include your common header and footer, common images (such as your logo on the page), andproduct images. The page looks like Listing 1. Let's go over this code.

First, pgen inserts the header file by finding header.html and inserting it in the includefile. The Merchant tag shown in callout A is a SQL Server directive to get information from yourdatabase. The fetchrows tag grabs data from your SQL Server database and places it into theproductinfo object. You can use the powerful fetchrows tag in several ways. The syntactical formatfor using fetchrows is:
[fetchrows nameForReference valRQuery valRArg1...valRArgN]

Using this syntax, nameForReference is the variable name that will contain the returneddata result set, and valRQuery is the reference name of the query in the SQL data table (thetable name is defined in the Registry; the ADD STORE feature in the Control Panel applet created thetable name for you if you used ADD STORE). The valRArg1...valRArgN terms are argumentsMerchant Server will pass to the SQL Server in the query.

In your database, in the SQL table that you defined (in the Registry key Database, ValueDb_table_sql) to store predefined SQL statements, the name column contains the reference name forthe query in the sql_text column. For example, the name selected-brand in the SQL tablerefers to select * from me_brand where brand_id = convert(numeric,:1) in the sql_textcolumn.

In this example, you can use
[fetchrows brands "selected-brand" 2]

to call the brands object, which contains all the information from the me_brand table, wherebrand_id = 2. To reference variables passed in the SQL table, use the :N argument in thetable (where N is the argument being passed). Use this variable for each argument you want to send,incrementing by one for each argument you want Merchant Server to process (e.g., :1, :2, :3). Usethis variable only in the sql_text entry in your sql table. Also note that the Merchant System sendsall variables using the fetchrows tag as text, so you have to use the convert(numeric,:1) function.You won't need that function if you want to match a text variable.

Now that I've explained the fetchrows tag, I need to talk about args.brand_id in the example.The args object contains all the variables from the page that called this page and posted values tothis page. If you were on the previous page and you need to send the brand_id value to this page,you can use the Merchant link tag to send the value easily. For the link to the next page, you canwrite
[form "thebrands.html" brand_id=brands]
"brands"> [option "NCR"] 1 [option "Compaq"] 2
[/form]

Or you can write
[link "thebrands.html" brand_
id=2]Go to brands page for Brand2[/link]

This directive not only sends you to the page "thebrands.html," but it also includesthe value for brand_id.

The args.object and the var.object differ in that a posting form passes the args.object, andthe Merchant let tag creates the var.object. For example,
[let cool_brand 2]

assigns the value 2 to var.cool.brand. When tagged such as

Sally uses brand [value var.cool_brand].

pgen outputs

Sally uses brand 2.

Now, back to the code. The directive [if brandinfo.img_file !="none"] applies a bitof logic to the code. In this example, if brandinfo.img_file is not equal to "none,"Merchant Server executes the first part of the if statement:
"[simg]/products/[value brandinfo.img_file]" BORDER=0>

After pgen gets through with this line, it looks like
"imagepath/products/
cool_brand.gif" BORDER=0>

Merchant Server is doing two things here. First, it is expanding the simg tag that representsthe path to your server's shared image directory. Second, it is expanding value brandinfo.img_fileto equal the value stored in the brandinfo recordset item named img_file. In this case, thevalue is the name of the corresponding image file for this brand.

Notice the code at B in Listing 1. This code uses the xlink directive, which has syntacticalformat
[xlink action argName1=value
RArg1...argNameN=valueRArgN]

The xlink directive is similar to the link tag with an important difference. When you click theoutput text between [xlink] and [/xlink], Merchant Server performs an action instead of going to apage directly. In this case, that action is order.additem, and I am sending that action a namedargument--in this case, sku=productinfo.sku. This code will generate a list of products, each with aunique xlink to the order.additem action, adding the product selected to the order. Merchant Serverwill execute whatever the action order.additem defines in the Registry. This function is handy,especially if you perform the same functions frequently. In this example, the argument passed is thesku of the product you want to add to the current order.

The eachrow tag syntax,
[eachrow NameForReference valueRStart valueREnd]

tells pgen to take the object that NameForReference references (starting at row 1 or aselect row range, hence valueRStart valueREnd), usually a recordset of some type, and flipthrough each row of data it contains, one at a time, until the end of the recordset is reached.Think of this process as a loop for your data, or if you are familiar with DAO, a Do loop for yourrecordset with a built-in MoveNext command. This example displays a list of products.

At the end of B in Listing 1, you see the money value display tag:
[money productinfo.list_price]

The syntactical format for this tag is
[money valueRAmount valueRLocale valueRScale]

You use this tag for converting a value (valueRAmount) into money. Using the optionalarguments valueRLocale and valueRScale, you can override the Registry defaults formoney location and scale to that of any country that Merchant Server supports. Although using theMerchant Server directives might seem complicated at first, you'll soon catch on. The results areworth the initial effort. Screen 1 is an example of a page created with Merchant Server.

From Mom and Pop to a Mall
Merchant System is a scalable product. You can use it to start a small store, and it will growwith you, with almost no growing pains. For example, my mother can use Merchant Server to displayher needlepoint patterns in an online craft store--a small business. This exposure will be great forher company. At the rate she generates patterns, she'll want to continually update the onlinecatalog to keep her customers interested. When she makes it as big as Trudy & Jenny's StitchPatch, she can easily migrate to a distributed system to keep the Web site running smoothly, withoutdelays. She can even open a virtual mall and rent space to anyone--from Rhoda next door to Crabtreeand Evelyn. The possibilities are virtually endless (pun intended). Best of all, Merchant Server iseasy to maintain. Once it's up and running, it's up to stay. Merchant Server's stability is a goodthing: I hate to think what would happen if my mother's server went down.

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like