Commit f7f95504d2dd822c5134fa9327a425d41cec13ee

Authored by Karnovsky A
1 parent 1aafb42d

-

common/modules/product/models/import.php renamed to common/modules/product/models/Import.php
... ... @@ -63,8 +63,7 @@ class Import extends Model {
63 63 return FALSE;
64 64 }
65 65  
66   - $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts'));
67   -
  66 + $filesize = filesize(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'));
68 67 if ($from) {
69 68 fseek($handle, $from);
70 69 }
... ... @@ -97,28 +96,29 @@ class Import extends Model {
97 96 // товары в пути
98 97 if (empty ($city_name))
99 98 {
100   - $this->saveNotFoundRecord (
101   - [$modification_code, $product_title],
102   - Yii::getAlias('@uploadFilePricesAway')
103   - );
  99 +// $this->saveNotFoundRecord (
  100 +// [$modification_code, $product_title],
  101 +// Yii::getAlias('@uploadFilePricesAway')
  102 +// );
104 103  
105 104 $this->output[] = 'Товар '. $product_title . ' в пути';
106 105  
107 106 continue;
108 107 }
109 108  
110   - if ( ($productVariant = ProductVariant::find()->filterWhere(['sku' => trim($modification_code)])->one()) === null ) {
  109 + if ( ($productVariant = ProductVariant::find()->filterWhere(['sku' => $modification_code])->one()) === null ) {
111 110 // 'Нет даной модификации в базе';
112   - $this->saveNotFoundRecord (
113   - [$modification_code, $product_title],
114   - Yii::getAlias('@uploadFilePricesNoVariant')
115   - );
  111 +// $this->saveNotFoundRecord (
  112 +// [$modification_code, $product_title],
  113 +// Yii::getAlias('@uploadFilePricesNoVariant')
  114 +// );
116 115  
117 116 $this->output[] = 'Для товара '. $product_title . ' не найдено соотвествие';
118 117  
119 118 continue;
120 119 }
121 120  
  121 +
122 122 $quantity = 0;
123 123  
124 124 // ===== Set stock ====
... ... @@ -161,7 +161,6 @@ class Import extends Model {
161 161  
162 162 if ($result['end']) {
163 163 unlink(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'));
164   - $this->output[] = '<font style="color:green; font-weight: bold">Импорт цен успешно завершен!</font>';
165 164 }
166 165  
167 166 return $result;
... ...
common/modules/product/models/ProductVariantTypeSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\modules\product\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\modules\product\models\ProductVariantType;
  9 +
  10 +/**
  11 + * ProductVariantTypeSearch represents the model behind the search form about `common\modules\product\models\ProductVariantType`.
  12 + */
  13 +class ProductVariantTypeSearch extends ProductVariantType
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['product_variant_type_id'], 'integer'],
  22 + [['name', 'name2'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = ProductVariantType::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'product_variant_type_id' => $this->product_variant_type_id,
  63 + ]);
  64 +
  65 + $query->andFilterWhere(['like', 'name', $this->name])
  66 + ->andFilterWhere(['like', 'name2', $this->name2]);
  67 +
  68 + return $dataProvider;
  69 + }
  70 +}
... ...