From: fomichev Date: Thu, 24 Oct 2024 10:08:55 +0000 (+0300) Subject: products_class X-Git-Tag: 1.6~13^2~33 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=8060d269e7e357c4703272cc1ddb70cd0540d646;p=erp24_rep%2Fyii-erp24%2F.git products_class --- 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) ]; }