]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Артикул товара флаувау
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Apr 2025 11:28:21 +0000 (14:28 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 17 Apr 2025 11:28:21 +0000 (14:28 +0300)
erp24/services/MarketplaceService.php

index 13f31c0bf088317e3bccdc5c815d37bed747412a..d765084f794942b7671c021ce4a7d13cbefe784d 100644 (file)
@@ -2083,7 +2083,7 @@ class MarketplaceService
             $orderItem->order_id = $orderId;
             $orderItem->external_item_id = $order['number'];
             $orderItem->offer_name = $item['name'];
-            $orderItem->offer_id = $item['name'];
+            $orderItem->offer_id = self::extractArticleCode($item['name']) ?? $item['name'];
             $orderItem->price = $item['price'];
             $orderItem->count = $item['count'];
             $orderItem->buyer_price = $item['price'];
@@ -2102,6 +2102,12 @@ class MarketplaceService
             }
         }
     }
-
+    public static function extractArticleCode($productName)
+    {
+        if (preg_match('/\(([^()]+)\)\s*$/u', $productName, $matches)) {
+            return $matches[1];
+        }
+        return null;
+    }
 
 }