How to Enable Storage of Shopper Receipts for Commerce Stores (254624)



The information in this article applies to:

  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q254624

SUMMARY

When you run the Site Builder Wizard, if you do not specify that you want to save customer receipts for a Commerce Store, you can add this functionality after the store has been built. The example in the "More Information" section of this article details how to do this using the ClockTower sample store.

MORE INFORMATION

Example

  1. Create a receipt storage function in Include\Util.asp or I_util.asp. The file that you add this function to depends on which file is available. Your particular store only has one or the other.

    When you add the function to the .asp file, make sure to include the appropriate arguments for the InitStorage function. To get the appropriate arguments, search for DBStorage.InitStorage in the Commerce 3.0 online documentation.

    <%
    function UtilGetReceiptStorage()
        REM Create a storage object for receipts
        Set receiptStorage = Server.CreateObject("Commerce.DBStorage")
        Call receiptStorage.InitStorage(MSCSSite.DefaultConnectionString, "clocktower_receipt", "order_id", "Commerce.OrderForm" , "marshalled_receipt", "date_entered")
        receiptStorage.Mapping.Value("_total_total") = "total"
    
        Set UtilGetReceiptStorage = receiptStorage
    end function
    %>
    						
  2. Call the UtilGetReceiptStorage function in xt_orderform_purchase.asp right after you run the plan pipeline:
        REM -- Run the plan
        errorLevel = UtilRunPipe("plan.pcf", mscsOrderForm, mscsPipeContext)
    
        REM Create the receipt storage
        Set mscsReceiptStorage = UtilGetReceiptStorage()
    
        REM Add the receipt storage into the pipe context...the Save Receipt component uses it
        Set mscsPipeContext.ReceiptStorage = MSCSReceiptStorage
    						
  3. Create the necessary table in the Commerce Server database to store receipts; something similar to the following can be used for the ClockTower sample site:
    REM Script to create receipt table
    create table clocktower_receipt
    (order_id char(26) not null,
    shopper_id char(32) not null,
    total int,
    status tinyint,
    date_entered datetime,
    date_changed datetime,
    marshalled_receipt image)
    						
  4. Add the SaveReceipt component to the accept stage of the purchase pipeline for the store.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbfix kbhowto KB254624