From bfa3408de7261ea3a461e3c725eb5f58cd0cb4b2 Mon Sep 17 00:00:00 2001 From: kFrolichs Date: Thu, 22 Feb 2018 16:32:48 +0100 Subject: [PATCH 1/2] Small syntax error fix and updated README to contain possible port troubles fix. --- README.md | 4 +++- vqmod/xml/orders_list.xml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c0a28ec..9036a36 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# Wuunder opencart plugin \ No newline at end of file +# Wuunder opencart plugin + +Troubles caused by use of other ports than HTTP can be fixed but are not part of the standard implementation. diff --git a/vqmod/xml/orders_list.xml b/vqmod/xml/orders_list.xml index f660f24..0ed715e 100644 --- a/vqmod/xml/orders_list.xml +++ b/vqmod/xml/orders_list.xml @@ -16,7 +16,7 @@ + if (is_null($order['booking_url']) || empty($order['booking_url'])) { ?> @@ -30,4 +30,4 @@ ]]> - \ No newline at end of file + From f33512ef1b0918df33dae7e899e4699db3a1e059 Mon Sep 17 00:00:00 2001 From: kFrolichs Date: Fri, 23 Feb 2018 17:22:42 +0100 Subject: [PATCH 2/2] Fixed error in data being overwritten by 2nd webhook. --- catalog/controller/module/wuunder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catalog/controller/module/wuunder.php b/catalog/controller/module/wuunder.php index 219a6d0..0faeffb 100644 --- a/catalog/controller/module/wuunder.php +++ b/catalog/controller/module/wuunder.php @@ -14,9 +14,11 @@ public function webhook() $order_id = $_REQUEST['order']; $booking_token = $_REQUEST['token']; $data = json_decode(file_get_contents('php://input'), true); + if ($data['action'] === "shipment_booked") { $this->db->query("UPDATE `wuunder_shipment` SET label_id = '" . $this->db->escape($data['shipment']['id']) . "', label_url = '" . $this->db->escape($data['shipment']['label_url']) . "', label_tt_url = '" . $this->db->escape($data['shipment']['track_and_trace_url']) . "' WHERE order_id = " . $order_id . " AND booking_token = '" . $booking_token . "'"); $this->load->model("checkout/order"); $this->model_checkout_order->addOrderHistory($order_id, 3); + } } } -} \ No newline at end of file +}