public function actionViewCards() {
$products = Products1c::find()->alias('p')->leftJoin('products_class pc', 'p.parent_id = pc.category_id')
->where(['pc.tip' => [ProductsClass::MARKETPLACE, ProductsClass::MARKETPLACE_ADDITIONAL]])->all();
- $matrixErp = MatrixErp::find()->where(['guid' => ArrayHelper::getColumn($products, 'id')])->all();
+ $matrixErp = MatrixErp::find()->where(['active' => 1, 'guid' => ArrayHelper::getColumn($products, 'id')])->all();
$matrixErpByGuid = [];
foreach ($matrixErp as $matrix) {
/* @var $matrix MatrixErp */
if (($matrixErpByGuid[$product->id]->price->price ?? 0) == 0) {
continue;
}
- $model = [
- 'offer' => [
- 'offerId' => $product->id,
- 'category' => 'Цветы',
- 'marketCategoryId' => '91284',
- 'name' => !empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ?
- $matrixErpByGuid[$product->id]->matrixProperty->display_name : $product->name,
- 'basicPrice' => [
- 'currencyId' => Model\CurrencyType::RUR,
- 'value' => $matrixErpByGuid[$product->id]->price->price,
- ],
- 'vendor' => 'База Цветов 24',
- 'weightDimensions' => new Model\OfferWeightDimensionsDTO([
- 'length' => $matrixErpByGuid[$product->id]->matrixProperty->length ?? 23,
- 'height' => $matrixErpByGuid[$product->id]->matrixProperty->height ?? 40,
- 'width' => $matrixErpByGuid[$product->id]->matrixProperty->width ?? 20,
- 'weight' => $matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15,
- ]),
- 'pictures' => ['https://media.erp-flowers.ru/media/view-image/' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)],
- 'description' => $matrixErpByGuid[$product->id]->matrixProperty->description ?? '-',
- ],
- ];
$viewModels [] = [
- 'offerId' => $product->id,
+ 'offerId' => $product->articule ?? $product->id,
'category' => 'Цветы',
'marketCategoryId' => 91284,
'name' => (!empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ?