ASP-Based Discount Sitelet

Location in SDK: SDK\Samples\Classic ASP\Discount Sitelet

The primary goal of the Discount Sitelet is to demonstrate how to create and apply discounts to items added to a shopping cart using the Campaign Manager module in Commerce Server Business Desk and the Basket pipeline. Using this sitelet, you can examine a demonstration of discounts based on hard coded catalog data, and understand how the discount pipeline component works in the Order Processing pipeline (OPP). The Discount Sitelet shows you how to:

  • Create a multilingual site
  • Use discounts as part of campaign management
  • Display discounts
  • Create click-required discounts
  • Create discount applications and expressions (targeted discounts)
  • Create discount events

The Discount Sitelet consists of a package file, which you unpack using Commerce Server Site Packager. The source code for the sitelet is included in this package. Using the Discount Sitelet, you can implement discounts on a Commerce Server-based Web site. No modification to the code is required to deploy the sitelet to a server running Commerce Server 2002.

Discounts in the sitelet are determined by what type of account the user has. Users that log in as Premier Users get 10 percent off all items in their basket. Premier Users also receive an additional 40 percent off Black Diamond Quicksilver II when they purchase Gibraltar. Users that log in as Standard Users get 50 percent off an item when they purchase three items.

Best coding practices are maintained in this sample, and the code represents the prescribed method of using the object model.

ASP-Based Discount Sitelet Code Notes

Installing the ASP-Based Discount Sitelet

ASP-Based Discount Sitelet Code Notes

The discounts, users, and catalog are hard-coded in the Discount Sitelet, meaning that this data is stored in the appropriate SQL Server site database tables during the site installation process.

This sitelet demonstrates multilingual functionality. The following languages are supported: English, French, German, and Japanese. Language character sets are set in the Main routine of several ASP pages using code such as the following:

Sub Main()
    Set g_ojbMsgMgr = Application ("MSCSMessageManager")
    Response.CharSet = "iso-8859-1"
End Sub

Ee810704.note(en-US,CS.20).gifNotes

  • MessageManager object entries are read from the file rc.xml.
  • This sitelet also supports multicurrency ordering.
  • This sitelet uses a hard-coded user ID, which is set in the file siteletconst.asp.
  • Users that log in as Premier Users get 10 percent off all items in their basket. They also recieve an additional 40 percent off Black Diamond Quicksilver II when they purchase Gibraltar. Users that log in as Standard Users get 50 percent off every third item in their basket.

Installing the ASP-Based Discount Sitelet

You unpack the Discount Sitelet using Commerce Server Site Packager. The package file is located in the following directory:

<drive>:\Program Files\Microsoft Commerce Server 2002\SDK\Samples\Classic ASP\Discount Sitelet\SDK-DISCOUNT-SITELET.PUP

Unpacking the ASP-based Discount Sitelet using the Custom unpack option and creating independent databases for each of the site resources is not recommended.

Use the following procedures to install the Discount Sitelet on one computer using the Quick mode in Site Packager.

To unpack the ASP-Based Discount Sitelet

To add a blank Business Desk to the ASP-Based Discount Sitelet

To import the Adventure Works Catalog

To view the ASP-Based Discount Sitelet

To unpack the ASP-Based Discount Sitelet

  1. Using Windows Explorer, navigate to Program Files\Microsoft Commerce Server 2002\SDK\Samples\Classic ASP\Discount Sitelet.

  2. Click the SDK-DISCOUNT-SITELET.PUP icon.

  3. In the Unpack screen, select Quick Unpack, and then click Next.

  4. In the Quick Unpack screen, ensure that the SQL Server computer name is correct, enter the SQL Server login name and password, and then click Next.

  5. In the Commerce Server Site Packager window recommending Windows Authentication, click OK.

    By default, the sitelets do not work with Windows Authentication. For more information about configuring the sitelets to work with Windows Authentication, see step 6 in Deploying Commerce Server Using Windows Authentication.

  6. In the Profiling System screen, accept the defaults, and then click Next.

  7. In the second Profiling System screen, accept the defaults, and then click OK.

  8. After the unpacking is complete, a dialog box appears with the message "Unpacking is complete!". Click Finish.

To add a blank Business Desk to the ASP-Based Discount Sitelet

Adding a Business Desk to the Discount Sitelet is optional.

  1. Click Start, point to Programs, point to Microsoft Commerce Server 2002, and then click Commerce Server Manager.
  2. In Commerce Server Manager, on the Tree tab, expand Commerce Server Manager, expand Commerce Sites, and then expand Discount Sitelet.
  3. Right-click Applications, point to New, and then click Add Application.
  4. In the Add Application From dialog box, select Blank.pup, and then click Open.
  5. In the Select Applications dialog box, in the Applications in the package box, clear the BlankSite option. Only the BlankBizDesk site option should be selected.
  6. Click Next.
  7. In the Select IIS Web Sites and Virtual Directories dialog box, do the following:
    Use this To do this
    Machine Name of IIS Server Type the computer name for the Internet Information Services (IIS) server.
    IIS Web site Select Default Web Site on the drop-down list.
    IIS Virtual Directory Type discountsiteletbizdesk where blankbizdesk currently appears.
  8. Click Next.
  9. In the Unpacking is complete dialog box, review the list of SQL databases and IIS applications that were created. To review the list of events that occurred while Site Packager was running, click View Log File.
  10. To close Site Packager, click Finish.
  11. To close Commerce Server Manager, in the Commerce Server Manager screen, on the Console menu, click Exit.
  12. In the Microsoft Management Console dialog box, click No.

To import the Adventure Works Catalog

  • After unpacking the Discount Sitelet and adding Business Desk, you can optionally import the Adventure Works Catalog into the Discount Sitelet. The Adventure Works Catalog is located at <drive>:\Program Files\Microsoft Commerce Server 2002\SDK\Samples\Classic ASP\Discount Sitelet\AdvWorksCatalog.xml.

For more information about importing the Adventure Works Catalog, see Importing an XML Catalog File.

To view the ASP-Based Discount Sitelet

  • In Internet Explorer, in the Address box, type HTTP: //<computer name>/DiscountSitelet, and then press ENTER.

See Also

Service Pack 2 Changes for Sitelets

Copyright © 2005 Microsoft Corporation.
All rights reserved.