config.php 3.85 KB
<?php
 return [
     'csv' =>
         ['web' =>
             ['class' => 'common\components\parsers\CustomCsvParser',
                 'auto_detect_first_line' => true,
                 'converter_conf' => [
                     'class' => 'common\components\parsers\CustomConverter',
                                        'configuration' => ["encode"   => 'DESCR'],]
             ],
          'console' =>
             ['class' => 'common\components\parsers\CustomCsvParser',
                 'auto_detect_first_line' => true,
                 'hasHeaderRow' => true,
                 'converter_conf' => [
                     'class' => ' common\components\parsers\CustomConverter',
                     'configuration' => ["string"   => 'DESCR',
                                         "float"   => 'PRICE',
                                         "brand"   => 'BRAND',
                                        "integer"   => ['BOX','ADD_BOX'],
                                        "multiply"   => [],
                                        "article"   => [],
                                        "details"   => []
                     ]
             ],],

             'basic_column' => [
                 Null  => 'Пусто',
                 "BRAND"  => 'Бренд',
                 "ARTICLE"=> 'Артикул',
                 "PRICE"  => 'Цена',
                 "DESCR"  => 'Наименование',
                 "BOX"    => 'Колво',
                 "ADD_BOX"=> 'В пути',
                 "GROUP"  => 'Группа RG'
             ],

             'crosses' =>  ['class' => 'common\components\parsers\CustomCsvParser',
                 'auto_detect_first_line' => true,
                 'min_column_quantity' => 4,
                 'hasHeaderRow' => true,
                 'keys' =>['ARTICLE', 'CROSS_ARTICLE', 'BRAND', 'CROSS_BRAND'],
                 'converter_conf' => [
                     'class' => ' common\components\parsers\CustomConverter',
                     'hasKey' => 1,
                     'configuration' => [
                         "brand"   => ['BRAND', 'CROSS_BRAND'],
                         "crosses"   => [],
                     ]
                 ],],
             ],
      'xml' =>
         ['console' =>
             ['class' => 'yii\multiparser\XmlParser',
                 'node' => 'Товар',
                 'hasHeaderRow' => true,
                 'keys' => [
                    "BRAND"  => 'Производитель',
                     "ARTICLE"=> 'Код',
                     "PRICE"  => 'Розница',
                     "DESCR"  => 'Наименование',
                     "BOX"    => 'Колво',
                     "ADD_BOX"=> 'Ожидаемое',
                     "GROUP"  => 'Группа'
                 ],
                 'converter_conf' => [
                     'class' => 'common\components\parsers\CustomConverter',
                     'configuration' => ["details"   => []
                         ],],
                 ],
             'web' =>
                 ['class' => 'yii\multiparser\XmlParser',
                     'node' => 'Товар',
                     'hasHeaderRow' => true,
                     'keys' => [
                         "BRAND"  => 'Производитель',
                         "ARTICLE"=> 'Код',
                         "PRICE"  => 'Розница',
                         "DESCR"  => 'Наименование',
                         "BOX"    => 'Колво',
                         "ADD_BOX"=> 'Ожидаемое',
                         "GROUP"  => 'Группа'
                     ],
                     'converter_conf' => [
                         'class' => 'common\components\parsers\CustomConverter',
                         'configuration' => ["details"   => []
                         ],],
                 ],
         ],

 ];