]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-148] доработка яндекс маркетплейса 5
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 12 Nov 2024 14:14:25 +0000 (17:14 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 12 Nov 2024 14:14:25 +0000 (17:14 +0300)
erp24/api2/controllers/YandexMarketController.php
erp24/migrations/m241112_133649_add_columns_to_table_matrix_erp_property.php [new file with mode: 0755]
erp24/records/MatrixErpProperty.php
erp24/views/matrix_erp_property/_form.php

index 202d7a990f59337da9ab40bd02c6cfc27a9ef0a4..44b8d205c2ef32f91b6c54e26e3f53a2bddad8eb 100644 (file)
@@ -107,12 +107,12 @@ class YandexMarketController extends Controller
                         '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)],
                 ],
diff --git a/erp24/migrations/m241112_133649_add_columns_to_table_matrix_erp_property.php b/erp24/migrations/m241112_133649_add_columns_to_table_matrix_erp_property.php
new file mode 100755 (executable)
index 0000000..bdad8a6
--- /dev/null
@@ -0,0 +1,32 @@
+<?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');
+    }
+}
index d69c8530cf98326e5753ce14fcdc0daf5ef7eb6f..3905a605506c91871254032e35ff7801cfdb821b 100644 (file)
@@ -22,6 +22,10 @@ use Yii;
  * @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
@@ -44,6 +48,7 @@ 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'],
             [
                 [
@@ -78,6 +83,10 @@ class MatrixErpProperty extends \yii\db\ActiveRecord
             'product_url' => 'Ссылка на продуктовую карточку, лежащую предположительно на api2',
             'flowwow_category' => 'Категория в flowwow',
             'flowwow_subcategory' => 'Подкатегория в flowwow',
+            'length' => 'Длина',
+            'width' => 'Ширина',
+            'height' => 'Высота',
+            'weight' => 'Вес',
         ];
     }
 
index 09e3f808d1d76881ce2e782106ef58d2cd0aeb05..03d41a7cf5145c3c5366d0f9e1f8df8d2deda7cd 100644 (file)
@@ -70,6 +70,14 @@ $this->registerJs(
 
     <?= $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,