close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Order Id not enterered in Order Details table

Thread began 8/04/2009 9:03 am by cheryl75100 | Last modified 8/05/2009 9:35 am by Eric Mittman | 1267 views | 1 replies |

cheryl75100

Order Id not enterered in Order Details table

This has actually been an ongoing problem, a year ago about one in 20 orders would not have the order id entered in the orderdetails table.
This month - 4 or 5 orders a day - about half - are not grabbing the order id.

issue - ORDER SUMMARY RECORDS CORRECTLY
ORDER DETAILS MISSING ORDER ID
This breaks the display of receipts

The insert statement references: Session("OrderNumber") the email receipt for those orders also does not have the order number and references the same session variable.

Can someone please help? When the order summary is stored in the database, it does insert the Session.SessionID but isn't it supposed to then send back the OrderNumber?

here is my code:

<%' WA eCart Store Cart Summary in Db
if (NOT WA_eCart_EOF(PV_eCart)) then
WA_connection = MM_wastore_STRING
WA_table = "orders"
WA_redirectURL = ""
WA_indexField = "OrderID"
WA_fieldNamesStr = "OrderReferenceID|OrderUserID|FName|OrderPhone|OrderEmail|OrderGST|OrderTotal|OrderSubTotal"
WA_fieldValuesStr = "" & cStr(Session.SessionID) & "" & "|" & "" & cStr((Rs_user.Fields.Item("buyer_ID").Value)) & "" & "|" & "" & cStr((Rs_user.Fields.Item("buyer_storename").Value)) & "" & "|" & "" & cStr((Rs_user.Fields.Item("buyer_phone").Value)) & "" & "|" & "" & cStr((Rs_user.Fields.Item("buyer_email").Value)) & "" & "|" & "" & cStr(WA_eCart_GetTax(PV_eCart)) & "" & "|" & "" & cStr(WA_eCart_GrandTotal(PV_eCart)) & "" & "|" & "" & cStr(WA_eCart_GetTaxableTotal(PV_eCart)) & ""
WA_columnTypesStr = "',none,''|none,none,NULL|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|none,none,NULL"
WA_sessionName = "OrderNumber"
indexFieldIndex = -1
WA_fieldValues = Split(WA_fieldValuesStr,"|")
WA_fieldNames = Split(WA_fieldNamesStr,"|")
WA_columns = Split(WA_columnTypesStr,"|")
set WA_editCmd = Server.CreateObject("ADODB.Command")
updateFieldValue = ""
WA_editCmd.ActiveConnection = WA_connection
if (WA_redirectURL <> "" AND Request.QueryString <> "" AND Request.QueryString.Count > 0) then
if (inStr(WA_redirectURL,"?") > 0) then
WA_redirectURL = WA_redirectURL & "&"
else
WA_redirectURL = WA_redirectURL & "?"
end if
WA_redirectURL = WA_redirectURL & Request.QueryString
end if
for i = 0 to Ubound(WA_fieldNames)
if (WA_indexField = WA_fieldNames(i)) then
indexFieldIndex = i
exit for
end if
next
if (indexFieldIndex >= 0) then updateFieldValue = WA_fieldValues(indexFieldIndex)
if (updateFieldValue = "") then updateFieldValue = cStr(Session(WA_sessionName))
updateColType = "none,none,NULL"
if (indexFieldIndex >= 0) then
updateColType = WA_columns(indexFieldIndex)
end if
if (updateFieldValue <> "" AND updateFieldValue <> "undefined") then
valueForWhere = WA_generateInsertParams(Array(WA_indexField), Array(updateColType), Array(updateFieldValue), -1)
sqlstr = "select " & WA_indexField & " from " & WA_table & " where " & WA_indexField & " = " & valueForWhere(2) & " order by " & WA_indexField & " DESC"
set WA_eCartRecordset = Server.CreateObject("ADODB.Recordset")
WA_eCartRecordset.ActiveConnection = WA_connection
WA_eCartRecordset.Source = sqlstr
WA_eCartRecordset.CursorType = 0
WA_eCartRecordset.CursorLocation = 2
WA_eCartRecordset.LockType = 1
WA_eCartRecordset.Open()
if (NOT WA_eCartRecordset.EOF) then
updateFieldValue = cStr(WA_eCartRecordset.Fields.Item(WA_indexField).Value)
else
updateFieldValue = ""
end if
WA_eCartRecordset.Close()
end if
if (updateFieldValue <> "" AND updateFieldValue <> "undefined") then
updateParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, indexFieldIndex)
valueForWhere = WA_generateInsertParams(Array(WA_indexField), Array(updateColType), Array(updateFieldValue), -1)
WA_editCmd.CommandText = "update " & WA_table & " SET " & updateParamsObj(3) & " where " & WA_indexField & " = " & valueForWhere(2)
WA_editCmd.Execute()
WA_editCmd.ActiveConnection.Close()
else
updateFieldValue = ""
insertParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, -1)
WA_editCmd.CommandText = "insert into " & WA_table & " (" & insertParamsObj(1) & ") values (" & insertParamsObj(2) & ")"
WA_editCmd.Execute()
WA_editCmd.ActiveConnection.Close()
end if
if (indexFieldIndex < 0) then
if (updateFieldValue = "") then
obj = WA_generateWhereClause(WA_fieldNames, WA_columns, WA_fieldValues, indexFieldIndex)
sqlstr = "select " & WA_indexField & " from " & WA_table & " where " & obj & " order by " & WA_indexField & " DESC"
set WA_eCartRecordset = Server.CreateObject("ADODB.Recordset")
WA_eCartRecordset.ActiveConnection = WA_connection
WA_eCartRecordset.Source = sqlstr
WA_eCartRecordset.CursorType = 0
WA_eCartRecordset.CursorLocation = 2
WA_eCartRecordset.LockType = 1
WA_eCartRecordset.Open()
if (NOT WA_eCartRecordset.EOF) then Session(WA_sessionName) = WA_eCartRecordset.Fields.Item(WA_indexField).Value
WA_eCartRecordset.Close()
else
Session(WA_sessionName) = updateFieldValue
end if
else
Session(WA_sessionName) = WA_fieldValues(indexFieldIndex)
end if
if (WA_redirectURL <> "") then
Response.Redirect(WA_redirectURL)
end if
end if
%>
<%' WA eCart Store Cart Details in Db
if (NOT WA_eCart_EOF(PV_eCart)) then
WA_connection = MM_wastore_STRING
WA_table = "orderdetails"
WA_redirectURL = ""
WA_indexField = "DetailOrderID"
WA_fieldNamesStr = "DetailOrderID|DetailProductID|DetailProductName|DetailProductDesc|DetailQuantity|DetailPrice"
WA_fieldValuesStr = "" & cStr( Session("OrderNumber") ) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "ID")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Name")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Description")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Quantity")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Price")) & ""
WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL"
indexFieldIndex = -1
WA_fieldValues = Split(WA_fieldValuesStr,"|")
if (WA_redirectURL <> "" AND Request.QueryString <> "" AND Request.QueryString.Count > 0) then
if (inStr(WA_redirectURL,"?") > 0) then
WA_redirectURL = WA_redirectURL & "&"
else
WA_redirectURL = WA_redirectURL & "?"
end if
WA_redirectURL = WA_redirectURL & Request.QueryString
end if
WA_cmdObjString = "ADODB.Command"
set WA_editCmd = Server.CreateObject(WA_cmdObjString)
WA_editCmd.ActiveConnection = WA_connection
WA_fieldNames = Split(WA_fieldNamesStr,"|")
WA_columns = Split(WA_columnTypesStr,"|")
for i = 0 to Ubound(WA_fieldNames)
if (WA_indexField = WA_fieldNames(i)) then
indexFieldIndex = i
exit for
end if
next
deleteFieldValue = cStr(WA_fieldValues(indexFieldIndex))
if (deleteFieldValue <> "" AND deleteFieldValue <> "undefined") then
deleteParamsObj = WA_generateInsertParams(Array(WA_indexField), Array(WA_columns(indexFieldIndex)), Array(deleteFieldValue), -1)
WA_editCmd.CommandText = "Delete from " & WA_table & " where " & WA_indexField & " = " & deleteParamsObj(2)
WA_editCmd.Execute()
end if
set PV_eCart = WA_eCart_MoveFirst(PV_eCart)
while (NOT WA_eCart_EOF(PV_eCart))
WA_fieldValuesStr = "" & cStr( Session("OrderNumber") ) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "ID")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Name")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Description")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Quantity")) & "" & "|" & "" & cStr(WA_eCart_DisplayInfo(PV_eCart, "Price")) & ""
WA_fieldValues = Split(WA_fieldValuesStr,"|")
insertParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, -1)
WA_editCmd.CommandText = "insert into " & WA_table & " (" & insertParamsObj(1) & ") values (" & insertParamsObj(2) & ")"
WA_editCmd.Execute()
set PV_eCart = WA_eCart_MoveNext(PV_eCart)
wend
set PV_eCart = WA_eCart_MoveFirst(PV_eCart)
WA_editCmd.ActiveConnection.Close()
if (WA_redirectURL <> "") then
Response.Redirect(WA_redirectURL)
end if
end if
%>

Sign in to reply to this post

Eric Mittman

It seems that the session variable is not getting set sometimes. I'm not sure why it would behave inconsistently like this. I have created a ticket for this issue, please login to WebAssist.com and visit your support history to update the ticket.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...