close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

HELP!!! OrderID not going to session

Thread began 2/21/2010 11:14 am by rce56100 | Last modified 2/22/2010 10:24 am by Jason Byrnes | 1180 views | 2 replies |

rce56100

HELP!!! OrderID not going to session

I have ecart 4.5.2.
When I Store the order summary, the OrderID is supposed to be store in a session variable. For some reason the session is not updated and remains blank. I have a deadline on this project and I have wasted a full day on this issue. Any suggestions:

Here is the store summary code:

<%' WA eCart Store Cart Summary in Db
if (cStr(Request.Form("Checkout.x")) <> "") then
WA_connection = MM_teli_STRING
WA_table = "Orders"
WA_redirectURL = ""
WA_indexField = "OrderID"
WA_fieldNamesStr = "CustomerID|GrandTotal|OrderDate|TimeKey"
WA_fieldValuesStr = WA_eCDB_ConvertNumber("" & cStr((members.Fields.Item("memberID").Value)) & "") & "|" & WA_eCDB_ConvertNumber("" & cStr(WA_eCart_GrandTotal(eLearning)) & "") & "|" & "" & cStr(Date()) & "" & "|" & "" & cStr(Now()) & ""
WA_columnTypesStr = "none,none,NULL|none,none,NULL|#,none,NULL|#,none,NULL"
WA_sessionName = "servOrderID"
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
%>

Sign in to reply to this post

rce56100

Working now.

I'm not sure what happened but it works fine now.

Sign in to reply to this post

Jason ByrnesWebAssist

Some php servers will encounter a bug in PHP where session that are created just before using the header() function to redirect to another page will not be saved. the work around for this bug is to use the session_commit() function before calling the header function.


find the following code on your apge:

php:
<?php

// WA eCart Redirect
if ($<your cart name>->redirStr != "")     {
  
header("Location: ".$<your cart name>->redirStr);
}
?>




where <your cart name> is the name of your eCart object, and add the session_commit() function before the header() function:

php:
<?php

// WA eCart Redirect
if ($<your cart name>->redirStr != "")     {
  
session_commit();
  
header("Location: ".$<your cart name>->redirStr);
}
?>
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...