problem with viewing all unprocessed orders
Hi:
I'm having a problem with the admin page in viewing all unprocessed orders (Intranet).
I combined the presentation code of the order to the user and the intranet/extranet presentation to admins and suppliers so that the same information is displayed (I've modified it for my purposes which makes this a sensible thing to do.)
According to the book, when presenting the order to the customer during the order creation process, the lines for a specfic order are retrieved into a recordset using:
pg 307
Set lines = Visit.Order.Lines(parts("partid"))
When presenting to the intranet/extranet user, and not in the process of creating the order, the lines are retrieved using:
pg 374
Set lines = Order.Lines(parts("PartID"))
My first problem is that it does not recognize Order in [Set lines = Order.Lines(parts("PartID"))] as an object. The error message is
Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'Order'
/store/site.asp, line 319
So, if
Set lines = Order.Lines(parts("PartID"))
is correct, then I don't understand why Order should be recognized as an object, or why it isn't, and this is my problem. I can't see how the Order object is properly configured because there is nowhere for it to get the utility parameter.
'Configure Order Object - Set up IUtility
Public Sub Configure(ByVal utility As IUtility, ByVal ID As Long)
Set m_utility = utility
m_ID = ID
End Sub
If it is wrong, and I think it is, then the alternative is to use
Set lines = Visit.Order.Lines(parts("partid"))
But if I use that alternative, then a different problem arises: extra records are inserted into the Orders table.
The reason: When the Visit object is configured, it sets a bunch of variables based on ASP Session object variables. However, these are only used in the process of gathering and creating the order, not during an administrative ASP session. In an administrative ASP session, these values are all Empty (0). One of those variables is m_OrderID.
' Configure - tells the Visit object a little about the site
Public Sub Configure(ByVal strSiteName As String, ByVal strMailDomain As String, _
ByVal strDBString As String, ByVal Session As Session)
' Assign the argument values to the variable names
m_strSiteName = strSiteName
m_strMailDomain = strMailDomain
m_strDBString = strDBString
'Hold the Session information
Set m_Session = Session
'Capture the basket, customer, and order IDs
If Not m_Session Is Nothing Then
m_BasketID = CLng(m_Session("BasketID"))
m_CustomerID = CLng(m_Session("CustomerID"))
m_OrderID = CLng(m_Session("OrderID"))
m_PrimaryMarket = CStr(m_Session("PrimaryMarket"))
m_QuoteOnly = CBool(m_Session("QuoteOnly"))
m_DistributorID = CLng(m_Session("DistributorID"))
End If
End Sub
When the Order object is created by Visit, part of the configuration of the Order object is to get and assign the OrderID.
Public Property Get Order() As Order
Set Order = New Order
Order.Configure Me, OrderID
End Property
Public Property Get OrderID() As Long
If m_OrderID = 0 Then
m_OrderID = Orders.SplitBasket(m_BasketID)
m_Session("OrderID") = m_OrderID
End If
OrderID = m_OrderID
End Property
This property procedure uses m_OrderID to determine if we are working with an existing order or if we need to create a new order. If m_OrderID is 0, then it is considered a new order and records are added to the Orders table, among others. However, m_OrderID is ALWAYS 0 when working in an administrative ASP session, so it will add records to the Orders table.
For now, I am working around the problem by using
Set lines = Visit.Order.Lines(parts("partid"))
and setting the Session("OrderID") variable in ASP to the OrderID of each record in Orders that is to be displayed, but that is a workaround. Something is wrong here and I'm not sure what.
Any help is greatly appreciated.
Thanks,
JK
|