x97wehner Posted March 17 Posted March 17 (edited) Hi, I noticed this issue long ago and cannot figure out what would be causing it. The issue is this: - If I process a partial refund for an order from the back office, my system will always add the product back to inventory, even if I did not select the "Re-stock product" checkbox. It's quite frustrating since I do not want it added back unless I check the box. I've tested this on a clean install of TB and it does not have this issue. So then I went back and disabled all overrides and non TB modules on my system and cleared the cache. It still happens no matter what I do. I've checked the orderdetail.php file and it is exactly the same as the clean install file. Same with AdminOrdersController.php. What else could be causing this issue that I'm facing? If i have all non TB modules disabled as well as overrides off, it should work the same as my clean install of TB, right? Any help is appreciated. Edited March 17 by x97wehner
wakabayashi Posted March 18 Posted March 18 Hard to say. I use this feature too, but with multiple overrides. The logic happens in AdminOrdersController.php -> postProcess() -> Tools::isSubmit('partialRefund') Also in AdminOrdersController there is function reinjectQuantity(), but IMO this should not even be called your case. if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Tools::isSubmit('reinjectQuantities')) && $orderDetailList[$idOrderDetail]['quantity'] > 0) { $this->reinjectQuantity($orderDetail, $orderDetailList[$idOrderDetail]['quantity']); } I would wonder, what your $order is returning on hasBeenDelivered(). Also the question is about which quantity you are talking. Are you using advanced stock management?
wakabayashi Posted March 18 Posted March 18 (edited) It might be, that I got pissed by this issue too in the past. Cause I just checked my override and there I only check for this: if ($orderDetailList[$idOrderDetail]['quantity'] > 0) { if (Tools::isSubmit('reinjectQuantities')) { $this->reinjectQuantity($orderDetail, $orderDetailList[$idOrderDetail]['quantity'], false, Configuration::get('PS_STOCK_CUSTOMER_ORDER_REASON')); } } So basically I remove the hasBeenDelivered() function... Edited March 18 by wakabayashi 1
x97wehner Posted March 18 Author Posted March 18 4 hours ago, wakabayashi said: It might be, that I got pissed by this issue too in the past. Cause I just checked my override and there I only check for this: if ($orderDetailList[$idOrderDetail]['quantity'] > 0) { if (Tools::isSubmit('reinjectQuantities')) { $this->reinjectQuantity($orderDetail, $orderDetailList[$idOrderDetail]['quantity'], false, Configuration::get('PS_STOCK_CUSTOMER_ORDER_REASON')); } } So basically I remove the hasBeenDelivered() function... I'm going to check this out. I agree, "Has been delivered" shouldn't even apply in this scenario and I'm guessing that is the problem. I'll let you know. Thank you.
x97wehner Posted March 19 Author Posted March 19 9 hours ago, x97wehner said: I'm going to check this out. I agree, "Has been delivered" shouldn't even apply in this scenario and I'm guessing that is the problem. I'll let you know. Thank you. This override worked perfect. It no longer adds the inventory back unless the box is checked. Thanks. 1
wakabayashi Posted March 19 Posted March 19 Good to know. The question is now, if this makes any sense for anyone. I really don't know why the core does this. The fact that you have issues and me too, makes this part of the code really dubious.
datakick Posted March 19 Posted March 19 It doesn't make much sense to me either. There is a checkbox in UI for merchants to decide if they want to restock or not. Code should no make some auto-magical decisions and ignore the user-selected settings. Let's remove this. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now