Post by baryho » Wed Feb 16, 2022 10:17 pm

Hi,

I have a problem with editing order in admin on OC 3.0.3.2.

Sometimes customer made an order in default currency. I would like to change that order in admin to another currency. There is 5 steps...on first one I change currency, on step 2 I see product(s) with correct new currency and on final step 5 is all visible in new currency (no problem) but clicking save opencart says "You order has been successfully modified orders" on green background but email comes with previous currency, in databse there are not updated columns: currency_id, currency_code, currency_value. Does anyone has the same problem? After clicking Save I see calling endpoint /api/order/edit and on response there is new currency. update_currency 1/0 does not help.

Thx

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by straightlight » Wed Feb 16, 2022 10:33 pm

More details.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by baryho » Thu Feb 17, 2022 2:28 pm

straightlight wrote:
Wed Feb 16, 2022 10:33 pm
More details.
What kind of details can I post? Should I install clean demo opencart with the same version and should I try it there because on all 3.0.3.2 it is fully functional (change currency on existing order) and it is confirmed?

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by baryho » Thu Feb 17, 2022 4:15 pm

I did fresh install of 3.0.3.2, after that without any modification I did an order in default USD currency and tried to change that in admin using order edit to EUR, no success :(

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by baryho » Thu Feb 17, 2022 7:03 pm

Fresh install 3.0.3.8 and the result is the same :(

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by ADD Creative » Thu Feb 17, 2022 7:45 pm

Looking at the code in the API edit function in catalog/controller/api/order.php and model_checkout_order->editOrder there is nothing that sets the currency when updating an order.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by baryho » Thu Feb 17, 2022 8:20 pm

So it explains a lot if it is the right place ;) Should I create an issue on opencart github or is it someones task who is developer of an Opencart and read this forum?
thx

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by paulfeakins » Thu Feb 17, 2022 8:38 pm

baryho wrote:
Thu Feb 17, 2022 4:15 pm
I did fresh install of 3.0.3.2
Does it happen in the current latest; 3.0.3.8?

baryho wrote:
Thu Feb 17, 2022 4:15 pm
after that without any modification I did an order in default USD currency and tried to change that in admin using order edit to EUR, no success :(
What exactly happened?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by baryho » Thu Feb 17, 2022 8:49 pm

paulfeakins wrote:
Thu Feb 17, 2022 8:38 pm
baryho wrote:
Thu Feb 17, 2022 4:15 pm
I did fresh install of 3.0.3.2
Does it happen in the current latest; 3.0.3.8?

baryho wrote:
Thu Feb 17, 2022 4:15 pm
after that without any modification I did an order in default USD currency and tried to change that in admin using order edit to EUR, no success :(
What exactly happened?
3.0.3.8 - yes on 3.0.3.8 it happen, it is written a few comments above

what exactly happened? - This topic is about problem with changing currency during order edit in admin area. So if you try to edit an order in admin area and in first step you change currency, at the end after saving in step 5 nothing happen and currency is still the same even in step 2 - 5 all is visible correctly in new currency changed on step 1. It looks it is because of
ADD Creative wrote:
Thu Feb 17, 2022 7:45 pm
Looking at the code in the API edit function in catalog/controller/api/order.php and model_checkout_order->editOrder there is nothing that sets the currency when updating an order.

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by by mona » Thu Feb 17, 2022 8:56 pm

You are correct, it has always been that way.
I may be wrong but there might be a legality issue to think about - if payment has not been made, that is one thing, but what about if payment has?
Just food for thought.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Thu Feb 17, 2022 9:06 pm

baryho wrote:
Thu Feb 17, 2022 8:20 pm
So it explains a lot if it is the right place ;) Should I create an issue on opencart github or is it someones task who is developer of an Opencart and read this forum?
thx
You could search on GitHub to see if the issue has already been raised. If there is nothing there create an issue, but don't be surprised if it's ignored or closed.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Newbie

Posts

Joined
Sat Sep 11, 2021 11:05 pm

Post by straightlight » Tue May 24, 2022 5:11 pm

:ponder:

This looks like it's an ongoing problem but I think I nailed down the issue. by mona would be correct on the topic; if the order has already been sent, it would not be exactly legate to change the currency code unless the payment service provider allows it. However, there is a way to validate this. Right now, the thing that's going on is that the currency code is propagated through the library which means throughout the entire platform. The extension payments can also track methods, such as the recurring payments for instance.

Point being, in the extension payment model methods from the core, I noticed there are a lot of currency methods where each payment service providers might be limited to which means that it's not only a question of when the order's already sent but also to know which currency code a store owner might be limited to.

Therefore, the way the core is currently developed to handle currency, while editing an order, would be correct since adding a new order, with added currency, is indeed the right way to do it but whenever an order gets edited, there's no way to know if the order has already been sent with the exception of the order status ID lookup from the addOrderHistory() method in catalog/model/checkout/order.php file.

With that being said, what we might need is a way to integrate a method, along with the recurringPayments() lookup, for the currencies, by extension, so to know if the order has already been sent in the first place. Otherwise, store owners would simply be convinced to void the last order and to create a new one and that can still be good for Business if the order hasn't been sent but if the order has already been sent, it wouldn't be too good after a while.

Furthermore, by adding a currency lookup method into the payment would also allow store owners to know if specific currencies are allowed as also to electronically verify the status of the order via their payment service providers prior to create their new orders to avoid this kind of confusion in the future and that can be done with an event trigger /before as an extra step.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: moreduff and 266 guests