This code works with Multistore version 9.3.1.0
After creating the column in the database and adding the code to your OrderConfirmation code behind page, new orders will contain the customerid of the Admin that took the phone order, per Sharona's code as well as add a note to the order.
Please write reports to pull orders using the customerserviceperson column, as the note is a text field and is more difficult to use for reports such as Crystal Reports.
I am not responsible for what you do with the code below, so make a backup of your database and code pages prior to attempting to use it. Good Luck.
================================================== ===
First create customerserviceperson column in orders table using T-SQL:
Code:
ALTER TABLE Orders
ADD customerserviceperson INT NOT NULL DEFAULT 0
In OrderConfirmation.aspx.vb (or OrderConfirmation.aspx.cs) look for this line:
Code:
DB.ExecuteSQL("update Customer set OrderOptions=NULL, OrderNotes=NULL, FinalizationData=NULL where CustomerID=" & CustomerID.ToString())
Right after the line above add the following code in VB.net:
Code:
Dim notes As New StringBuilder()
If MyBase.IsInImpersonation AndAlso MyBase.EditingOrderImpersonation = 0 Then
'new order with impersonation
notes.AppendFormat("|Phone Order Added By ({0} - {1}) on {2} {3}", MyBase.AdminImpersonatingCustomer.CustomerID, MyBase.AdminImpersonatingCustomer.FullName(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString())
DB.ExecuteSQL(String.Format("update orders set CustomerServicePerson = {0} where ordernumber = {1}", DB.SQuote(MyBase.AdminImpersonatingCustomer.CustomerID.ToString()), ord.OrderNumber))
End If
If MyBase.IsInImpersonation AndAlso MyBase.EditingOrderImpersonation > 0 Then
'edit order with impersonation
notes.AppendFormat("|Phone Order Edited By ({0} - {1}) on {2} {3}", MyBase.AdminImpersonatingCustomer.CustomerID, MyBase.AdminImpersonatingCustomer.FullName(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString())
End If
DB.ExecuteSQL(String.Format("update orders set notes = cast(notes as nvarchar(max)) + {0} where ordernumber = {1}", DB.SQuote(notes.ToString()), ord.OrderNumber))
or of you have C# this will do it:
Code:
StringBuilder notes = new StringBuilder();
if (base.IsInImpersonation && base.EditingOrderImpersonation == 0)
{
//new order with impersonation
notes.AppendFormat("|Phone Order Added By ({0} - {1}) on {2} {3}",
base.AdminImpersonatingCustomer.CustomerID,
base.AdminImpersonatingCustomer.FullName(),
DateTime.Now.ToShortDateString(),
DateTime.Now.ToShortTimeString());
DB.ExecuteSQL(string.Format("update orders set CustomerServicePerson = {0} where ordernumber = {1}", DB.SQuote(base.AdminImpersonatingCustomer.CustomerID.ToString()), ord.OrderNumber));
}
if (base.IsInImpersonation && base.EditingOrderImpersonation > 0)
{
//edit order with impersonation
notes.AppendFormat("|Phone Order Edited By ({0} - {1}) on {2} {3}",
base.AdminImpersonatingCustomer.CustomerID,
base.AdminImpersonatingCustomer.FullName(),
DateTime.Now.ToShortDateString(),
DateTime.Now.ToShortTimeString());
}
DB.ExecuteSQL(string.Format("update orders set notes = cast(notes as nvarchar(max)) + {0} where ordernumber = {1}", DB.SQuote(notes.ToString()), ord.OrderNumber));
================================================== ===
And....
Viola! It works!