}
$photoLink = $baseUrl . '/marketplace/upload?guid=' . $marketplaceOrder->guid;
+ $delivery = is_string($marketplaceOrder->raw_data)
+ ? json_decode($marketplaceOrder->raw_data, true)['delivery'] ?? []
+ : $marketplaceOrder->raw_data['delivery'] ?? [];
+ if ($marketplaceOrder->marketplace_id == 2) {
+ $delivery = array_intersect_key($delivery, array_flip(['address', 'date', 'notes']));
+ }
+ if (!empty($delivery)) {
+ $deliveryString = json_encode($delivery, JSON_UNESCAPED_UNICODE);
+ } else {
+ $deliveryString = 'нет данных';
+ }
+
$result[] = [
'id' => $marketplaceOrder->guid,
'store_id' => $store_id,
- 'comment' => 'Создано из ERP ' . $marketplaceOrder->marketplace_order_id,
'summ' => $summ,
'seller_id' => '',
'status' => 0,
'delivery_address' => $deliveryAddress,
'items' => $itemsFiltered,
'photo_link' => $photoLink,
- 'comment_data' => json_encode([
- 'delivery' => $rawData['delivery'] ?? null,
- 'products_without_guid' => $marketplaceOrder->getProductsWithoutArticule(),
- ])
+ 'comment' => 'Создано из ERP ' . $marketplaceOrder->marketplace_order_id .
+ '. Доставка: ' . $deliveryString .
+ ', Товары без артикула: ' . implode(', ', array_map(
+ fn(array $p) => "{$p['product_id']} x{$p['quantity']}",
+ $marketplaceOrder->getProductsWithoutArticule()
+ ))
// 'marketplace_order_id' => $marketplaceOrder->marketplace_order_id,
// 'status_id' => $marketplaceOrder->status_id,
// 'substatus_id' => $marketplaceOrder->substatus_id,