From e6185d8563736e406bca4d7b064c1c2c1ee68381 Mon Sep 17 00:00:00 2001 From: Freddy Rommel <15031079+rommelfreddy@users.noreply.github.com> Date: Mon, 18 Nov 2019 11:04:29 +0100 Subject: [PATCH] RATEPLUG-27: fix batch processing (admin) (#33) --- .../Events/OrderOperationsSubscriber.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Bootstrapping/Events/OrderOperationsSubscriber.php b/Bootstrapping/Events/OrderOperationsSubscriber.php index 2d25f79d..26999e8c 100644 --- a/Bootstrapping/Events/OrderOperationsSubscriber.php +++ b/Bootstrapping/Events/OrderOperationsSubscriber.php @@ -91,18 +91,21 @@ public function onBidirectionalSendOrderOperation(\Enlight_Hook_HookArgs $argume */ public function afterOrderBatchProcess(\Enlight_Hook_HookArgs $arguments) { - $request = $arguments->getSubject()->Request(); - $config = Shopware()->Plugins()->Frontend()->RpayRatePay()->Config(); - if (!$config->get('RatePayBidirectional')) { return; } + $controller = $arguments->getSubject(); - $orders = $request->getParam('orders'); + $orders = $controller->Request()->getParam('orders', []); + $singleOrderId = $controller->Request()->getParam('id', null); + + if (count($orders) < 1 && empty($singleOrderId)) { + return; + } - if (count($orders) < 1) { - throw new \Exception('No order selected'); + if (count($orders) == 0) { + $orders = [['id' => $singleOrderId]]; } foreach ($orders as $order) {