Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pete Naylor 21 posts 39 karma points
    Dec 14, 2011 @ 15:59
    Pete Naylor
    0

    Event to call if changing address.

    I've seen another post on this forum on a way to add an existing address to an order by adding properties.

    order.AddProperty( new OrderProperty( "address", "test" ) );
    order.AddProperty( new OrderProperty( "zipCode", "7430" ) );

    I want to populate the billing address from values I already have in the database, but what event is best to hook this code onto? I need to add this data before step 2 of the checkout process.

    Also would I need to use "order.save()" at this point?

    I tried the following and I could no longer add events to the cart:

    public void Initialize()
    {
        WebshopEvents.OrderCreated += WebshopEvents_AddAddress;

    }

    private void WebshopEvents_AddAddress(Order order)
    {
    order.AddProperty(new OrderProperty("address", "test"));
    order.Save();

    }

     

  • Anders Burla 2560 posts 8256 karma points
    Dec 14, 2011 @ 16:07
    Anders Burla
    0

    Hi Pete

    The best event would be the order created event - or you could at the step 1 button and a "magic" orderproperty named "addAddress" and hook into the OrderPropertiesUpdated event and add the address properties and delete the "magic" one again.

    Didnt the OrderCreated event execute or what do you mean by "I tried the following and I could no longer add events to the cart"

    If you add properties to the order - you need to save it again

    Kind regards
    Anders

  • Pete Naylor 21 posts 39 karma points
    Dec 14, 2011 @ 16:16
    Pete Naylor
    0

    When I added the Order.Save() line and tested adding an item to the cart. The "processing symbol" appeared next to the item I have added and in the cart and nothing happens for around 10 seconds, then I get a javascript popup "cart error" with no message on Opera. On Chrome it seems to knock out IIS causing me to reset the service.

    I'll have a look and see what I can do with step one.

  • Anders Burla 2560 posts 8256 karma points
    Dec 14, 2011 @ 16:47
    Anders Burla
    0

    Ill try and replicate the error tomorrow

  • Pete Naylor 21 posts 39 karma points
    Dec 14, 2011 @ 17:24
    Pete Naylor
    0

    Ok, this is odd.

    The following works fine:

    public void Initialize()
    {
      WebshopEvents.OrderLineAdded += WebshopEvents_OrderLineAdded;   
    }

    void WebshopEvents_OrderLineAdded(Order order, OrderLine orderLine)
      {
     order.AddProperty(new OrderProperty("streetAddress", "test"));
      order.Save(); 
    }
     

    However if I put the same code into WebshopEvents.OrderCreated then I get the crash. Have I set up the event correctly in the first post?

  • Anders Burla 2560 posts 8256 karma points
    Dec 15, 2011 @ 14:04
    Anders Burla
    0

    Hi Pete

    Found the bug and fixed it - the order.Save resulted in an infinite loop in the OrderCreated event - try and download the latest beta that I just uploaded at http://our.umbraco.org/projects/website-utilities/tea-commerce

    Kind regards
    Anders

  • Pete Naylor 21 posts 39 karma points
    Dec 15, 2011 @ 16:58
    Pete Naylor
    0

    Oddly enough, this hasn't fixed it for me.

    I installed the latest version package in Umbraco and reset IIS just in case, but I still get the same error. Is there anything else I need to do when upgrading?

     

     

  • Anders Burla 2560 posts 8256 karma points
    Dec 16, 2011 @ 10:26
    Anders Burla
    0

    Hi Pete

    So you installed Tea Commerce 1.4.2.0 BETA 1 - and not just the latest official release?

    Kind regards
    Anders

  • Pete Naylor 21 posts 39 karma points
    Dec 16, 2011 @ 11:07
    Pete Naylor
    0

    Sorry Anders.

    You are right. I have both the Beta and official zip in the same folder and I had misread the file name. Working great now. Thanks for your help! 

  • Anders Burla 2560 posts 8256 karma points
    Dec 16, 2011 @ 11:51
    Anders Burla
    0

    Your welcome - if you could mark the right answer as the solution to your question it would help orthers to easy find this - thanks in advance

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft