]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
правка апи для 1с origin/change_result_api_format
authormarina <m.zozirova@gmail.com>
Tue, 17 Jun 2025 14:18:12 +0000 (17:18 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 17 Jun 2025 14:18:12 +0000 (17:18 +0300)
erp24/api2/controllers/OrdersController.php

index 8ab6caec99c065315578614678786e15762ed13c..491363a7d50b5e434920247ae54a85fb065a3475 100644 (file)
@@ -218,20 +218,23 @@ class OrdersController extends BaseController
 
             $result = [];
             foreach ($orders as $order) {
-                $products = [];
+                $items = [];
 
                 foreach ($order->items as $product) {
                     $product1c = Products1c::findOne(['articule' => $product->offer_id]);
 
                     if ($product1c) {
-                        $products[$product1c->id] = $product->count;
+                        $items[] = [
+                            'product_id' => $product1c->id ?? null,
+                            'quantity' => $product->count ?? null,
+                        ];
                     }
                 }
 
                 $result[] = [
                     'order_id' => $order->guid,
                     'status' => $order->status_id,
-                    'products' => $products,
+                    'items' => $items,
                 ];
             }