From 8060d269e7e357c4703272cc1ddb70cd0540d646 Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 24 Oct 2024 13:08:55 +0300 Subject: [PATCH] products_class --- erp24/api2/controllers/FlowwowController.php | 2 +- erp24/services/MarketplaceService.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/erp24/api2/controllers/FlowwowController.php b/erp24/api2/controllers/FlowwowController.php index db576bc4..ae136b33 100644 --- a/erp24/api2/controllers/FlowwowController.php +++ b/erp24/api2/controllers/FlowwowController.php @@ -15,7 +15,7 @@ class FlowwowController extends Controller public function actionFeed() { // Получаем информацию о продуктах - $productsInfo = MarketplaceService::getSomeProductsInfo(6); + $productsInfo = MarketplaceService::getAllProductsInfo(); // Генерируем XML-фид $xmlFeed = MarketplaceService::createXMLFeed($productsInfo); diff --git a/erp24/services/MarketplaceService.php b/erp24/services/MarketplaceService.php index 41659569..44316f7d 100644 --- a/erp24/services/MarketplaceService.php +++ b/erp24/services/MarketplaceService.php @@ -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) ]; } -- 2.39.5