Wrox Programmer Forums
|
ASP E-commerce As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP E-commerce section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2004, 12:47 AM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old June 17th, 2004, 05:39 PM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi:

FWIW - I worked out the problem. In combining the presentation code, I broke the RenderOrder subroutine into a number of smaller subroutines: OrderHeader, OrderPayment, OrderLines, and OrderAmounts.

In doing so,

Set lines = Order.Lines(intOrderID)

was in the subroutine that writes out the Order Lines and could no longer access an existing Orders object, previously instantiated by

Set Order = objVisit.Orders.GetOrderObject(Order("StoreOrderID "))

Once I restructured it to allow that subroutine access to the Order object, and therefore an existing Orders object, everything worked as it should.

Thanks,

JK





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Viewing Dreamweaver w/Firefox mantaray Dreamweaver (all versions) 3 June 24th, 2008 04:42 PM
Chapter 7 Orders File stabor BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 5 September 10th, 2007 09:25 AM
Problem Viewing Large Images arimakidd BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 November 20th, 2006 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.