]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
изменения фида
authorJoySystem_v <fvv2011@gmail.com>
Mon, 26 Aug 2024 10:23:52 +0000 (13:23 +0300)
committerJoySystem_v <fvv2011@gmail.com>
Mon, 26 Aug 2024 10:23:52 +0000 (13:23 +0300)
erp24/services/MarketplaceService.php

index f9adf09c68138a8349b2163a2d553ba4f09fe000..6e95710b77d1298b5516a5bd01833e403d4dac57 100644 (file)
@@ -39,7 +39,7 @@ class MarketplaceService
             $result[] = [
                 'id' => $product->id,
                 'name' => $product->name,
-                'picture' => self::getProductPictureUrl($product->id),
+                'pictures' => self::getProductPictureUrl($product->id),
                 'price' => self::getProductPrice($product->id),
                 'oldprice' => self::getProductOldPrice($product->id),
                 'description' => self::getProductDescription($product->id),
@@ -66,9 +66,9 @@ class MarketplaceService
         $xml->addAttribute('date', date('Y-m-d\TH:i:sP'));
 
         $shop = $xml->addChild('shop');
-        $shop->addChild('name', 'BestSeller');
-        $shop->addChild('company', 'The Best inc.');
-        $shop->addChild('url', 'http://best.seller.ru');
+        $shop->addChild('name', 'База Цветов 24');
+        $shop->addChild('company', 'База Цветов 24');
+        $shop->addChild('url', 'https://bazacvetov24.ru');
 
         // Добавление валюты
         $currencies = $shop->addChild('currencies');
@@ -81,7 +81,7 @@ class MarketplaceService
         $category = $categories->addChild('category', 'Букеты');
         $category->addAttribute('id', '1');
 
-        // Добавление информации о доставке
+        // Добавление информации о доставке???
         $deliveryOptions = $shop->addChild('delivery-options');
         $deliveryOption = $deliveryOptions->addChild('option');
         $deliveryOption->addAttribute('cost', '200');
@@ -93,7 +93,8 @@ class MarketplaceService
             $offer = $offers->addChild('offer');
             $offer->addAttribute('id', $product['id']);
             $offer->addChild('name', htmlspecialchars($product['name']));
-            $offer->addChild('url', 'http://best.seller.ru/product_page.asp?pid=' . $product['id']);
+            //TODO добавить url на конкректный букет
+            $offer->addChild('url', 'https://bazacvetov24.ru/flowers/' . $product['id']);
             $offer->addChild('price', $product['price']);
             $offer->addChild('currencyId', 'RUR');
             $offer->addChild('categoryId', '1');
@@ -117,10 +118,13 @@ class MarketplaceService
             }
 
             foreach ($product['composition'] as $component) {
-                $consist = $offer->addChild('param', $component['quantity']);
+                $consist = $offer->addChild('consist', $component['quantity']);
                 $consist->addAttribute('name', htmlspecialchars($component['name']));
                 $consist->addAttribute('unit', $component['unit']);
             }
+            foreach ($product['pictures'] as $picture) {
+                $offer->addChild('picture', $picture);
+            }
         }
 
         return $xml->asXML();
@@ -128,7 +132,7 @@ class MarketplaceService
 
     // Приватные статические вспомогательные методы
     private static function getProductPictureUrl($productId) {
-        return 'https://files.erp24.ru/pic.jpg';
+        return ['https://files.erp24.ru/pic.jpg'];
     }
     private static function getProductPrice($productId) {
         $price = Prices::find()