Compare commits

...

4 Commits

Author SHA1 Message Date
OpenXE
c7b84603d4 Bugfix woocommerce ImportUpdateAuftrag tracking 2024-09-15 16:33:39 +02:00
OpenXE
24f6623016 bugfix OrderStatusUpdateRequest shipments default value empty array 2024-09-15 16:32:38 +02:00
OpenXE
ffaca2a7f3 bugfix woocommerce shoprueckmeldung 2024-09-15 16:06:44 +02:00
OpenXE
1710318e80 bugfix erpapi importauftrag shopextid 2024-09-15 16:05:33 +02:00
3 changed files with 12 additions and 11 deletions

View File

@ -26,7 +26,7 @@ class OrderStatusUpdateRequest
/**
* @var Shipment[] list of shipments for this order
*/
public array $shipments;
public array $shipments = array();
public function getTrackingNumberList() : array {
$list = [];
@ -45,4 +45,4 @@ class OrderStatusUpdateRequest
}
return $list;
}
}
}

View File

@ -19040,7 +19040,7 @@ function CheckShopTabelle($artikel)
}
}
return array("status" => true, "$auftragid" => $auftrag);
return array("status" => true, "auftragid" => $auftrag);
}

View File

@ -202,9 +202,7 @@ class Shopimporter_Woocommerce extends ShopimporterBase
'warenkorb' => base64_encode(serialize($order)),
];
}
return $tmp;
}
// This function searches the wcOrder for the specified WC Meta key
@ -424,19 +422,22 @@ class Shopimporter_Woocommerce extends ShopimporterBase
{
/** @var OrderStatusUpdateRequest $data */
$data = $this->CatchRemoteCommand('data');
if ($data->orderStatus !== OrderStatus::Completed)
return;
$trackingCode = $data->shipments[0]?->trackingNumber;
if (isset($data->shipments)) {
$trackingCode = $data->shipments[0]?->trackingNumber;
}
if (!empty($trackingCode)) {
$this->client->post('orders/'.$data->orderId.'/notes', [
$this->client->post('orders/'.$data->shopOrderId.'/notes', [
'note' => 'Tracking Code: ' . $trackingCode
]);
$this->logger->info("WooCommerce Tracking Code Rückmeldung für Auftrag: ".$data->orderId,
[
'orderId' => $data->orderId,
'orderId' => $data->shopOrderId,
'trackingCode' => $trackingCode
]
);
@ -447,7 +448,7 @@ class Shopimporter_Woocommerce extends ShopimporterBase
'meta_data' => [
[
'key' => 'tracking_code',
'value' => $data->shipments[0]?->trackingNumber
'value' => $trackingCode
],
[
'key' => 'shipping_carrier',
@ -455,11 +456,11 @@ class Shopimporter_Woocommerce extends ShopimporterBase
]
],
];
$this->client->put('orders/'.$data->orderId, $updateData);
$this->client->put('orders/'.$data->shopOrderId, $updateData);
$this->logger->info("WooCommerce Statusrückmeldung 'completed' für Auftrag: ".$data->orderId,
[
'orderId' => $data->orderId,
'orderId' => $data->shopOrderId,
'status' => $this->statusCompleted
]
);