'value' => $matrixErpByGuid[$product->id]->price->price,
],
'vendor' => 'База Цветов 24',
-// 'weightDimensions' => [
-// 'height' => 40,
-// 'length' => 23,
-// 'weight' => 0.15,
-// 'width' => 20,
-// ],
+ 'weightDimensions' => [
+ 'height' => $matrixErpByGuid[$product->id]->matrixProperty->height ?? 40,
+ 'length' => $matrixErpByGuid[$product->id]->matrixProperty->length ?? 23,
+ 'weight' => $matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15,
+ 'width' => $matrixErpByGuid[$product->id]->matrixProperty->width ?? 20,
+ ],
'description' => $matrixErpByGuid[$product->id]->matrixProperty->description ?? '-',
'pictures' => ['https://media.dev1.erp-flowers.ru/media/view-image?id=' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)],
],
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241112_133649_add_columns_to_table_matrix_erp_property
+ */
+class m241112_133649_add_columns_to_table_matrix_erp_property extends Migration
+{
+ const TABLE_NAME = 'erp24.matrix_erp_property';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $this->addColumn(self::TABLE_NAME, 'length', $this->float()->null()->comment('Длина товара'));
+ $this->addColumn(self::TABLE_NAME, 'width', $this->float()->null()->comment('Ширина товара'));
+ $this->addColumn(self::TABLE_NAME, 'height', $this->float()->null()->comment('Высота товара'));
+ $this->addColumn(self::TABLE_NAME, 'weight', $this->float()->null()->comment('Вес товара'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropColumn(self::TABLE_NAME, 'weight');
+ $this->dropColumn(self::TABLE_NAME, 'height');
+ $this->dropColumn(self::TABLE_NAME, 'width');
+ $this->dropColumn(self::TABLE_NAME, 'length');
+ }
+}
* @property string|null $product_url Ссылка на карточку товара, например, выложенную без пароля по api2
* @property string|null $flowwow_category Точное название категории в flowwow, будет ограничено селектом в интерфейсе
* @property string|null $flowwow_subcategory Точное название подкатегории в flowwow, будет ограничено селектом в интерфейсе
+ * @property float|null $length Длина товара
+ * @property float|null $width Ширина товара
+ * @property float|null $height Высота товара
+ * @property float|null $weight Вес товара
*
*/
class MatrixErpProperty extends \yii\db\ActiveRecord
return [
[['guid', 'date'], 'required'],
[['description'], 'string'],
+ [['length', 'width', 'height', 'weight'], 'number'],
[['image_id', 'created_admin_id', 'updated_admin_id'], 'integer'],
[
[
'product_url' => 'Ссылка на продуктовую карточку, лежащую предположительно на api2',
'flowwow_category' => 'Категория в flowwow',
'flowwow_subcategory' => 'Подкатегория в flowwow',
+ 'length' => 'Длина',
+ 'width' => 'Ширина',
+ 'height' => 'Высота',
+ 'weight' => 'Вес',
];
}
<?= $form->field($modelMatrixErpProperty, 'url_link_video')->textInput() ?>
+ <?= $form->field($modelMatrixErpProperty, 'length')->textInput(['type' => 'number']) ?>
+
+ <?= $form->field($modelMatrixErpProperty, 'width')->textInput(['type' => 'number']) ?>
+
+ <?= $form->field($modelMatrixErpProperty, 'height')->textInput(['type' => 'number']) ?>
+
+ <?= $form->field($modelMatrixErpProperty, 'weight')->textInput(['type' => 'number']) ?>
+
<div class="form-group">
<?= $form->field($modelMatrixErpProperty, 'mediaFiles')->widget(MultipleInput::className(), [
'min' => 0,