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.
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
- 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.
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.
- Using Windows Explorer, navigate to Program Files\Microsoft Commerce Server 2002\SDK\Samples\Classic ASP\Discount Sitelet.
- Click the SDK-DISCOUNT-SITELET.PUP icon.
- In the Unpack screen, select Quick Unpack, and then click Next.
- 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.
- 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.
- In the Profiling System screen, accept the defaults, and then click Next.
- In the second Profiling System screen, accept the defaults, and then click OK.
- After the unpacking is complete, a dialog box appears with the message "Unpacking is complete!". Click Finish.
Adding a Business Desk to the Discount Sitelet is optional.
- Click Start, point to Programs, point to Microsoft Commerce Server 2002, and then click Commerce Server Manager.
- In Commerce Server Manager, on the Tree tab, expand Commerce Server Manager, expand Commerce Sites, and then expand Discount Sitelet.
- Right-click Applications, point to New, and then click Add Application.
- In the Add Application From dialog box, select Blank.pup, and then click Open.
- 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.
- Click Next.
- 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.
- Click Next.
- 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.
- To close Site Packager, click Finish.
- To close Commerce Server Manager, in the Commerce Server Manager screen, on the Console menu, click Exit.
- In the Microsoft Management Console dialog box, click No.
- 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.
- In Internet Explorer, in the Address box, type HTTP: //<computer name>/DiscountSitelet, and then press ENTER.
See AlsoCopyright © 2005 Microsoft Corporation.
All rights reserved.