Hi folks, got a tricky problem today; I'll see if I can keep the explanation simple.
I've written a module that adds a BasketCharge to the order during checkout (never mind why; I'm trying to keep this simple). That part is working fine. The client sometimes makes changes to an order, such as changing the quantity of an item, on the Order Processing admin page. When that happens, the amount of the BasketCharge needs to be adjusted. I've written some Module_Order_Content code that provides a button the client can click, which triggers the module to examine the changed order and update the BasketCharge. But the client asked if this updating can happen automatically whenever they make changes to the order; and that part has me stumped.
I tried using the not_orderitem API to update the BasketCharge whenever they make changes to an item, but it doesn't work as expected. Apparently there's some kind of sandboxing going on, so that the module's changes don't have the expected result. Apparently the store makes a copy of the order in a variable, so that some of my module's changes end up getting overwritten.
It's possible that, with some more trial-and-error, I could figure out what's happening internally, so that I could have my module do some extra math and DB updates to get the desired result. But I'm reluctant to go too far down that road, when I have no access to the admin.mv code to find out what's really going on.
Do you have any experience with this sort of thing? Any advice, work-arounds, etc.?
Thanks; hope everyone's staying healthy --
I've written a module that adds a BasketCharge to the order during checkout (never mind why; I'm trying to keep this simple). That part is working fine. The client sometimes makes changes to an order, such as changing the quantity of an item, on the Order Processing admin page. When that happens, the amount of the BasketCharge needs to be adjusted. I've written some Module_Order_Content code that provides a button the client can click, which triggers the module to examine the changed order and update the BasketCharge. But the client asked if this updating can happen automatically whenever they make changes to the order; and that part has me stumped.
I tried using the not_orderitem API to update the BasketCharge whenever they make changes to an item, but it doesn't work as expected. Apparently there's some kind of sandboxing going on, so that the module's changes don't have the expected result. Apparently the store makes a copy of the order in a variable, so that some of my module's changes end up getting overwritten.
It's possible that, with some more trial-and-error, I could figure out what's happening internally, so that I could have my module do some extra math and DB updates to get the desired result. But I'm reluctant to go too far down that road, when I have no access to the admin.mv code to find out what's really going on.
Do you have any experience with this sort of thing? Any advice, work-arounds, etc.?
Thanks; hope everyone's staying healthy --
Comment