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;
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
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.
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?
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();
}
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
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.
Ill try and replicate the error tomorrow
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?
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
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?
Hi Pete
So you installed Tea Commerce 1.4.2.0 BETA 1 - and not just the latest official release?
Kind regards
Anders
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!
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
is working on a reply...