Commit ebf6e240fc1d664e7aa4fadf1d7ec422deca8a11
1 parent
cf77cbae
14.09.16
Showing
2 changed files
with
12 additions
and
3 deletions
Show diff stats
common/modules/product/models/Import.php
| @@ -75,7 +75,7 @@ class Import extends Model { | @@ -75,7 +75,7 @@ class Import extends Model { | ||
| 75 | 75 | ||
| 76 | $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); | 76 | $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); |
| 77 | 77 | ||
| 78 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | 78 | + while ((empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE ) |
| 79 | { | 79 | { |
| 80 | foreach ($data as &$value) | 80 | foreach ($data as &$value) |
| 81 | { | 81 | { |
| @@ -214,7 +214,7 @@ class Import extends Model { | @@ -214,7 +214,7 @@ class Import extends Model { | ||
| 214 | 214 | ||
| 215 | $result_items = []; | 215 | $result_items = []; |
| 216 | 216 | ||
| 217 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | 217 | + while ( (empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE) |
| 218 | { | 218 | { |
| 219 | 219 | ||
| 220 | 220 |
common/modules/product/models/Product.php
| @@ -230,7 +230,16 @@ class Product extends \yii\db\ActiveRecord | @@ -230,7 +230,16 @@ class Product extends \yii\db\ActiveRecord | ||
| 230 | 230 | ||
| 231 | public function getFullName() | 231 | public function getFullName() |
| 232 | { | 232 | { |
| 233 | - return empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; | 233 | + $words = [ |
| 234 | + 'Рюкзаки' => 'Рюкзак', | ||
| 235 | + 'Несессеры' => 'Несессер', | ||
| 236 | + 'Сумки' => 'Сумка', | ||
| 237 | + 'Чехлы' => 'Чехол', | ||
| 238 | + 'Кошельки' => 'Кошелек', | ||
| 239 | + 'Гермочехлы' => 'Гермочехол', | ||
| 240 | + ]; | ||
| 241 | + $name = empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; | ||
| 242 | + return empty($this->category->categoryName->value) ? $name : (isset($words[$this->category->categoryName->value])? $words[$this->category->categoryName->value]: '') .' '. $name; | ||
| 234 | } | 243 | } |
| 235 | 244 | ||
| 236 | public function getCategories() { | 245 | public function getCategories() { |