Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 8 of 8

Thread: Freezing Recurring Shipping Address

  1. #1
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Default Freezing Recurring Shipping Address

    Hi,

    I wanted to know if their was a way to freeze the recurring shipping address for a customer. Here is the situation:

    Son wants to order product for his dad, on a recurring monthly basis.
    Son wants to order product for himself at a different address, on a recurring monthly basis.

    Now...On the next ship date, it appears that the new recurring orders ship to whatever the current Son's main shipping address is. Both packages are received by the son, and the dad receives nothing.

    Is there a way to have new recurring orders continue to use the address on the parent recurring order, rather than having new orders use the default ship to address that the son currently has?

    Thanks
    A

  2. #2
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    If the son create's the dad's address as a new address, and assigns that address when he placed the order, then the order will be shipped to dad. If the son changes that address back to his own, then he will start getting the packages. The address ID comes from the cart that contains the recurring orders. If the address tied to that ID is updated, then future recurring orders will reflect the update.

  3. #3
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Arrow

    Dan,

    I have finally tested this... and I am a bit upset at what I found. Below I show a step by step process to verify this process.



    Step-1:

    I entered a recurring order for my brother. The image shows that this order is order number 103589. I query the following tables: Orders, Orders_ShoppingCart, ShoppingCart, and address.

    From the image (Step-1) we can see that the addressid for my brother is 10451, and matches all tables.






    Step-2

    I then create two more orders. First one for myself because I want a recurring product every month, then one for my sister for a non-recurring product purchase because I simply want her to try it.

    Each time, I change the address I have on file to the appropriate one. The 3 orders created are 103589,103998,103999 as shown in the screenshot. All three appear correctly on the Orders & Orders_ShoppingCart tables, however we start seeing an issue on the ShoppingCart table. This last table which updates ALL the ShippingAddressID's whenever a customer chooses a new address as their primary shipping address. In my case, it changed all ShippingID's to my sister's address, even though she does not have a recurring order in the system. See screenshot (Step-2). At this point, I am sure the dev gurus know what is going to happen next month, when the recurring orders are due again... (At this point many are probably saying .. "Oh SH*T!"





    Step-3

    So let's run the recurring orders and see if I am right... When you inspect the next screenshot (Step-3) you can now see what has happened. In the image we see the 3 original orders (2 recurring and 1 single non recurring order). We also see the two new orders that were created, as they have the ParentOrderNumber field populated. As you can see the new orders did not use the proper AddressID's we selected and are shown in the parent order's Orders_ShoppingCart. Instead the two new orders now both go to the Sister's address, instead of to my brother and myself. The confusion this has caused is extraordinary, as my sister is wondering why the heck she is receiving so many things every month... while my brother and I are pissed that we did not get our shipments.





    So Dan,
    I appreciate your answer...however as I have found out, it looks like it is incorrect.

    I really wish you guys can separate the presentation layer from the logic, since it would be a million times easier to fix this if it were housed in an SQL Proc, than re-compiling things.

    To that effect, can you guys fix this?
    If not, what is the page I need to go to fix the code "Process this order" or "Process Charges" links shown in the last screenshot (Step-4).






    I would really appreciate it if you can help, as we do have many issues for customer that are shipping things to their family members across the USA.

    Thank you
    Last edited by usascholar; 03-25-2010 at 11:53 AM.

  4. #4
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Please send this into support, make sure reference this thread so you won't have to provide additional information. We can investigate this there and see if we can replicate.

  5. #5
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Arrow

    Anyway you can simply state where in the code to find the code "Process this order" or "Process Charges" links shown in the last screenshot? I bought the code for V8, I even bought the V9 upgrade, and am planning the upgrade again on our next box to 64bit... but I will not upgrade the production server to V9 at this time, (I want others to test it for at least 2 weeks before considering it).

    Simple things like this info on code pages saves me a lot of time.
    Besides, I am still waiting on another ticket to be resolved... (googletrackingcode) that seems very simple but support has yet to resolve.

    I figure this one is worse as it affects customers and I will need to resolve it because support is taking longer than expected on my first ticket. If anyone else not associated with ADNSF is able to answer, please do so. I will post the code changes here when it is resolved.

    Thanks

  6. #6
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Exclamation

    Ok...

    I went back, downloaded the binaries, dumped them into my site. It broke some skin work, but I prefer for the Recurring Shipping to work properly over skin work...

    Using freshly downloaded compiled binaries, this issue still happens..

    (where did steps 1-4 go? they are in the post that was blocked...see first post)

    Step 5
    Here we see myself create a recurring order for my sis. Everything looks good and her ShippingAddressID is fine so far, since the storefront correctly shows her shippingaddressID.



    Step 6
    Here we see myself create a recurring order for myself. Things don't look good anymore in this image. The shippingaddressid for my sisters recurring order stored in the ShoppingCart has been replaced by my own shippingaddressid.




    Again... this was done using new binaries from a version 8 that I downloaded. These are stock binaries, no fiddling with them.

    It appears that the recurring order system does not work for more than one address, since their appears to be a bad update that hits the ShoppingCart table whenever someone selects a new address from the address book.


    Ok... I am not here just to point fingers, but also offer a temporary solution while the smart people fix this:

    First create a new table to store the ShippingAddressIDs... (For some reason as soon as the recurring orders go through the ShippingID's are overwritten in the PARENT order . So basically you will lose all history of the original shippingorderid that was used in the parent order. (yes here is the URL is you want to see the same data shown above after the recurring orders get charged http://www.revgenetics.com/images/sq...base Query.jpg )

    Now, as I was saying... create a new table and call it "Orders_ParentAddress". This will hold the original shippingIDs. :

    C#/VB.NET Code:
    CREATE TABLE [dbo].[Orders_ParentAddress](
        [
    OriginalRecurringOrderNumber] [intNULL,
        [
    ShippingAddressID] [intNULL,
        [
    CreatedDate] [datetimeNOT NULL
    ON [PRIMARY]

    GO

    ALTER TABLE 
    [dbo].[Orders_ParentAddressADD  CONSTRAINT [DF_Orders_ParentAddress]  DEFAULT (getdate()) FOR [CreatedDate]
    GO 

    Then write a nasty, horrible piece of SQL (stored Proc) that will serve as a bandaid ... But mind you... you may still not get all of them right. But it should catch most address id issues if you run it right before you charge your daily recurring orders (I know, not good for most.. but it works for me):

    C#/VB.NET Code:

    Create Procedure 
    [dbo].[zpInsertMatchedAddressInParentAddress]

    as

    Insert Into Orders_ParentAddress
    Select  
    o
    .OrderNumber as OriginalRecurringOrderNumber
    max(a.AddressID) as ShippingAddressID,
    getdate() as CreatedDate

    from Address a inner join Orders o
    On a
    .Address1 o.ShippingAddress1 
        
    and a.Address2 o.ShippingAddress2 
        
    and a.City o.ShippingCity 
        
    and a.zip o.Shippingzip
        
    and a.FirstName o.ShippingFirstName
        
    and a.customerid o.customerid
    left outer Join Orders_ParentAddress OA
    on o
    .OrderNumber OA.OriginalRecurringOrderNumber

    Where o
    .ParentOrderNumber is null and OA.OriginalRecurringOrderNumber is null
    Group by o
    .OrderNumber
    o.transactionstate,
    a.CustomerID
    a.Address1
    order by o
    .OrderNumber

    Update shoppingcart
    --Select o.BillingFirstName,o.ShippingFirstNameshoppingcart.* 
    set shoppingcart.ShippingAddressID Orders_ParentAddress.ShippingAddressID
    From shoppingcart inner join Orders_ParentAddress
    on shoppingcart
    .OriginalRecurringOrderNumber Orders_ParentAddress.OriginalRecurringOrderNumber
    inner join Orders o
    on shoppingcart
    .OriginalRecurringOrderNumber o.OrderNumber
    where o
    .BillingFirstName <> o.ShippingFirstName

    Go 
    Again I present all the code above without any warranties what-So-Ever, if you lose data it is not my problem. I am just letting you know my solution to this horrible mess.
    Last edited by usascholar; 03-27-2010 at 02:46 PM.

  7. #7
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Unhappy

    Quick update....

    apparently one of the errosr may be found here:

    AspDotNetStoreFrontCore.ShoppingCart

    The method below updates all ShoppingCart items regardless of AddressID or Order number with the customers shipping address and not the original Order original shoppingcart's shipping address :

    LoadFromDB(CartTypeEnum CartType)


    C#/VB.NET Code:
                    if (ThisCustomer.PrimaryShippingAddressID != 0)
                    {
                        
    // repair addresses if required
                        // force all "0" or "invalid" address id records in the cart to be set to the primary shipping address. This is to avoid total confusion
                        // later in the cart where gift registry items, multi-ship items, etc, are all involved!
                        
    DB.ExecuteSQL("update shoppingcart set ShippingAddressID=" ThisCustomer.PrimaryShippingAddressID.ToString() + " where CartType=" + ((int)CartTypeEnum.ShoppingCart).ToString() + " and CustomerID=" ThisCustomer.CustomerID.ToString() + " and GiftRegistryForCustomerID=0 and (ShippingAddressID=0 or ShippingAddressID not in (select AddressID from Address  with (NOLOCK)  where CustomerID=" m_ThisCustomer.CustomerID.ToString() + "))"m_DBTrans);
                    } 
    I am pointing this out, for the folks looking to find a better fix than my crappy SQL that I provided. The comments state that it was done for invalid id's. however "ThisCustomer" does not refer to the cart, rather it refers to the full customer information pulled from the database which always includes the primary shipping address ID. So the two main issues I see: 1- the SQL updates all shipping ID's for shoppingcart records for this customer ID. 2- The well meaning developer somehow is using the Customer info incorrectly to test for a cart Shipping Address ID.

    Very weird, I hope it gets fixed one of these days for everyone else.
    Last edited by usascholar; 05-31-2010 at 01:03 PM.

  8. #8
    usascholar is offline Member
    Join Date
    Jan 2010
    Posts
    64

    Unhappy

    After shoppingcart is fixed you would need to move on to the gateway.cs code:

    Mainly the CreateOrderRecord function, as it uses the customer's primary shippingID, rather than the carts shipping id when creating the final order in the system. The cart is still in memory, and could be used to fix the final order when it is created and emailed to your recurring customers.

    Without fixing this last piece, the customers will always receive an incorrect email saying that you are shipping to their primary address, instead of to their family members' address. And Yes they will call you upset, and frustrated almost every month until it is fixed.

    Hope this helps others.
    Last edited by usascholar; 05-31-2010 at 01:44 PM.