public function actionFeed()
{
// Получаем информацию о продуктах
- $productsInfo = MarketplaceService::getSomeProductsInfo(6);
+ $productsInfo = MarketplaceService::getAllProductsInfo();
// Генерируем XML-фид
$xmlFeed = MarketplaceService::createXMLFeed($productsInfo);
use yii_app\records\Prices;
use yii_app\records\Products1c;
+use yii_app\records\ProductsClass;
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 = [];
'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)
];
}