]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Проверка с категории
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Nov 2024 12:22:38 +0000 (15:22 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Nov 2024 12:22:38 +0000 (15:22 +0300)
erp24/services/MarketplaceService.php

index a46145f58a2123aab46c14282e519556936e4016..4845c01d8e1ce3cebe2ffa21997f6af333944029 100644 (file)
@@ -228,7 +228,7 @@ class MarketplaceService
         $products = Products1c::find()
             ->where(['tip' => 'products'])
             ->andWhere(['not', ['components' => '']])
-          //  ->andWhere(['parent_id' => $parents])
+            ->andWhere(['parent_id' => $parents])
 
             ->all();
 
@@ -290,7 +290,7 @@ class MarketplaceService
             $result[] = [
                 'id' => $product->id,
                 'name' => $properties['displayName'],
-                'pictures' => MarketplaceService::getProductImageUrl($product->id),
+                'pictures' => [$properties['imageUrl']],
                 'price' => $price,
                 'oldprice' => MarketplaceService::getProductOldPrice($product->id),
                 'description' => MarketplaceService::getProductDescription($product->id),
@@ -367,7 +367,7 @@ class MarketplaceService
             $offer->addChild('price', $product['price']);
             $offer->addChild('oldPrice', $product['oldprice']);
             $offer->addChild('currencyId', 'RUB');
-            $offer->addChild('categoryId', $product['category_id']); // Здесь нужно указать правильный ID категории для продукта
+            $offer->addChild('categoryId', $product['category_id']);
 
             // Добавление доступности доставки
             $offer->addChild('delivery', 'true');
@@ -419,7 +419,7 @@ class MarketplaceService
             ->one();
 
         if (!$product) {
-            return null; // Вернуть null, если продукт не найден
+            return null;
         }
 
         return [
@@ -443,8 +443,8 @@ class MarketplaceService
         if ($mediaRecord && $mediaRecord->file_id) {
             return 'https://media.dev.erp-flowers.ru/media/view?id=' . $mediaRecord->file_id;
         }
-
-        return null; // Возвращаем null, если изображение не найдено
+        return 'https://media.dev.erp-flowers.ru/media/view?id=' . $imageId;
+       // return null;
     }
     private static function getProductLinkByGuid($guid) {
         return 'https://media.dev.erp-flowers.ru/media/view-card?guid=' . urlencode($guid);