]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
products_class
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 24 Oct 2024 10:08:55 +0000 (13:08 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 24 Oct 2024 10:08:55 +0000 (13:08 +0300)
erp24/api2/controllers/FlowwowController.php
erp24/services/MarketplaceService.php

index db576bc4e92f1210a48f08a7c7770f0285dbda3b..ae136b339bb71b353046022761704f1e5649e80e 100644 (file)
@@ -15,7 +15,7 @@ class FlowwowController extends Controller
     public function actionFeed()
     {
         // Получаем информацию о продуктах
-        $productsInfo = MarketplaceService::getSomeProductsInfo(6);
+        $productsInfo = MarketplaceService::getAllProductsInfo();
 
         // Генерируем XML-фид
         $xmlFeed = MarketplaceService::createXMLFeed($productsInfo);
index 416595699a7e4b891f10fededbc9acd02cd9c4ae..44316f7dc5ec7ce877856ae96281513614256c46 100644 (file)
@@ -4,6 +4,7 @@ namespace yii_app\services;
 
 use yii_app\records\Prices;
 use yii_app\records\Products1c;
+use yii_app\records\ProductsClass;
 
 class MarketplaceService
 {
@@ -14,9 +15,17 @@ class MarketplaceService
      */
     public static function getAllProductsInfo()
     {
+
+        $parents = ProductsClass::find()
+            ->select('category_id')
+            ->where(['tip' => 'marketplace'])
+            ->one();
+
+
         $products = Products1c::find()
             ->where(['tip' => 'products'])
             ->andWhere(['not', ['components' => '']])
+            ->andWhere(['parent_id' => $parents])
             ->all();
 
         $result = [];
@@ -44,11 +53,13 @@ class MarketplaceService
                 'oldprice' => self::getProductOldPrice($product->id),
                 'description' => self::getProductDescription($product->id),
                 'qty' => self::getProductQty($product->id),
+                'amount' => self::getProductQty($product->id),
                 'weight' => self::getProductWeight($product->id),
                 'minorder' => self::getProductMinOrder($product->id),
                 'composition' => $composition,
                 'available' => self::getProductAvailability($product->id),
                 'category_id' => self::getProductCategory($product->id),
+                'params' => self::getProductParams($product->id)
             ];
         }