I have a situation in version 1.4.4.2 where the customer can choose a specific paymenthod means the backend will have to react by setting the CurrentCurrency of the active order to a specific currency (and change back to default if another paymentmethod is selected). I have though so far been unable to find any setter for the currency of an order in C# (the one in javascript seems inapropriate due to this being a backend response).
Is there any way to change the currency of an order from c# in version 1.4.4.2?
I do, but setting it like "order.CurrencyId = newId" seems to just change that number without any change to any of its other properties. Do I have to set each individual property in order.CurrentCurrency to the desired values or would TeaCommerce set the rest of the properties for me? (for some reason I expected the latter to be the case when setting the Id, and since it didn't happen I assumed I was doing it wrong) :)
Since no setter is available I expected changing the Id manually would fire an event within teacommerce, (since something similar happens when setting the sessioncontroller's currentorderid to 0) finding the currency with the Id in question and setting that object as the current currency after which it would fire the WebshopEvents.CurrencyChanged event where I handle my custom properties.
The question remains though, while setting every property of the current currency manually is doable, how do I get TeaCommerce to do this with a its own logic?
Yeah in Tea Commerce 1.x the events are only called when you use the JavaScript or XSLT/Razor API - NOT the .NET API so that is why the event isnt invoked. In Tea Commerce 2.0 this is done the right way and the events are in the .NET layer.
If you want to change the currency - use the SessionController to change it. It will change it for the current order and fire the events.
How do you set currency of an order in C#
Hello
I have a situation in version 1.4.4.2 where the customer can choose a specific paymenthod means the backend will have to react by setting the CurrentCurrency of the active order to a specific currency (and change back to default if another paymentmethod is selected). I have though so far been unable to find any setter for the currency of an order in C# (the one in javascript seems inapropriate due to this being a backend response).
Is there any way to change the currency of an order from c# in version 1.4.4.2?
Thanks in advance,
Anders
You don't have the order.CurrencyId? Im looking at it in the source right now and its public :)
Kind regards
Anders
I do, but setting it like "order.CurrencyId = newId" seems to just change that number without any change to any of its other properties. Do I have to set each individual property in order.CurrentCurrency to the desired values or would TeaCommerce set the rest of the properties for me? (for some reason I expected the latter to be the case when setting the Id, and since it didn't happen I assumed I was doing it wrong) :)
Thanks in advance
Anders
What would you expect it to change. When you change the currency id - that is changed for the order. no other things change automatic.
Kind regards
Anders
Since no setter is available I expected changing the Id manually would fire an event within teacommerce, (since something similar happens when setting the sessioncontroller's currentorderid to 0) finding the currency with the Id in question and setting that object as the current currency after which it would fire the WebshopEvents.CurrencyChanged event where I handle my custom properties.
The question remains though, while setting every property of the current currency manually is doable, how do I get TeaCommerce to do this with a its own logic?
Best Regards
Anders
Hi Anders
Yeah in Tea Commerce 1.x the events are only called when you use the JavaScript or XSLT/Razor API - NOT the .NET API so that is why the event isnt invoked. In Tea Commerce 2.0 this is done the right way and the events are in the .NET layer.
If you want to change the currency - use the SessionController to change it. It will change it for the current order and fire the events.
Kind regards
Anders
Cool, thank you very much :D
is working on a reply...