Microsoft KB Archive/317111

= HOW TO: Order Status Code and Modify User Profile Definition =

Article ID: 317111

Article Last Modified on 10/26/2002

-

APPLIES TO


 * Microsoft Commerce Server 2000 Standard Edition

-



This article was previously published under Q317111



IN THIS TASK
SUMMARY
 * Modify the User Profile Definition
 * Add a New Data Code
 * Make the ASP Code Changes
 * Make the XML Code Changes
 * Restart Internet Information Services
 * Log On with the Modified User

REFERENCES



SUMMARY
This article provides the steps to take to understand the modifications that you have to make to add a status code. You might have to take additional steps based on your Commerce site and specific needs.

Use the Orders module to search your Commerce Server database for existing order information. With order status, you can track the location of an order in the order process. There are three default order status codes:
 * 4 (New Order)
 * 2 (Saved Order)
 * 1 (Basket)

To add order status codes to track the location of an order in the order process, see the product documentation: Commerce Server 2000\Working with Business Desk\Business Desk Orders\Adding Order Status Codes.

back to the top

Modify the User Profile Definition
  Use Microsoft SQL Server Enterprise Manager to extend the UserObject table, and then add an attribute. To do so, open the UserObject table in Design mode, and then add the following attribute: i_requireapproval, varchar 255,allow nulls For additional information, see the SQL Server documentation.  Add the new data member to the User Object. To do so, select the attribute that you created in step 1 and define it as a string data type. For information about how to add a new data member, visit the following Microsoft Web site:

Adding a New Data Member

 Add a User Site Term attribute:

User Site Term: NeedApproval

Display name: Need Approval

Under Terms, add two terms:

Term Name 1: Display Name No Approval

Term Name 2: Display Name Need Approval

For information about how to add a site term, visit the following Microsoft Web site:

Adding Site Terms

 Add an attribute to the User Object\General Information.  The properties for the new value are:

Name: Need_Approval

Display name: Need Approval

Type: Site Term

Type reference: Need Approval

 Under Advanced Attributes\Map to data, map it to the attribute that you exposed in step 2.</ol>

For information about how to add a new property, visit the following Microsoft Web site:

To Add a New Property

For information about how to add a site term to a profile definition, visit the following Microsoft Web site:

To Add a Site Term to a Profile Definition

</li></ol>

back to the top

Add a New Data Code

 * 1) Add a new data code: Open Business Desk, locate Orders Module\Data Codes. For Code, type 8, for Code Name and Description type Approval.
 * 2) Locate Users Module\Publish Profiles, select the correct Web server number, and then click publish changes to production and refresh the cache.
 * 3) Use Microsoft SQL Server Enterprise Manager to set one of your users to need approval when the user places orders: Open the UserObject table, locate a user, and then set the i_RequireApproval column to NeedApproval.

NOTE: For an actual site, you have to make modifications to allow a business manager to do this through the user interface.

For additional information, see the SQL Server documentation.

back to the top

Make the ASP Code Changes
NOTE: This procedure is based on the use of the Retail solution site. <ol>  Add the following code to the SaveBasketAsOrder function, which is located in Inetpub\wwwroot\retail\include\Payment.asp\: 'Checks to see if the user needs approval and if it does, sets the order status code to &quot;5&quot; If mscsUserProfile.GeneralInfo.Need_Approval.Value <> &quot;1&quot; Then mscsOrderGrp.Value(&quot;order_status_code&quot;) = 8 End If                   </li>  Add the following code to the GetOrderFormData function, which is located in Inetpub\retailbizdesk\orders\orderstatus_view.asp\: If Request.Form(&quot;update&quot;)=&quot;true&quot; Then With g_oOrderGroup.value(&quot;order_status_code&quot;)=Request.Form(&quot;order_status_code&quot;).saveasorder End With End If                   </li>  Replace the following code in the GetXMLOrderSummaryData function, which is located in Inetpub\retailbizdesk\orders\orderstatus_view.asp\:

Existing code: sBuffer = sBuffer & &quot;<order_status_code>&quot; & g_MSCSAppConfig.DecodeStatusCode(g_oOrderGroup.Value(&quot;order_status_code&quot;)) & &quot;</order_status_code>&quot; New code: sBuffer = sBuffer & &quot;<order_status_code>&quot; & g_oOrderGroup.Value(&quot;order_status_code&quot;) &&quot;</order_status_code>&quot; </li></ol>

back to the top

Make the XML Code Changes
<ol>  Add the following code to Inetpub\retailbizdesk\config\Orders.xml. To do so, use the Find command on Taskback.gif, and then place the following code after the lines of code that are related to the   element: task icon='tasksaveback.gif' id='saveback'> <postto action='orders/orderstatus_view.asp' formname='saveform' /> Bac<U>k</U> k            Save Order Status and back to Order Status List <task icon='tasksave.gif' id='save'> <postto action='orders/orderstatus_view.asp' formname='saveform' />

<U>S</U>ave s            Save Order Status </li></ol>

back to the top

Restart Internet Information Services
To restart Internet Information Services, click Start, click Run, and then type iisreset.

back to the top

Log On with the Modified User
Log on with the user profile that you have modified to required approval for order placement.

Complete a purchase and verify that the user's order status is set to Approval by selecting Orders in the Customer Service module.

To display the new order, open your Business Desk, locate Orders Module\Order Status to display the new order. The order status should display Approval. To modify the order status, select and open the order status.

back to the top

<div class="references_section">