diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php index d7fea3d..6186c3f 100755 --- a/common/modules/product/models/Import.php +++ b/common/modules/product/models/Import.php @@ -75,7 +75,7 @@ class Import extends Model { $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) + while ((empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE ) { foreach ($data as &$value) { @@ -214,7 +214,7 @@ class Import extends Model { $result_items = []; - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) + while ( (empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE) { diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index 3f6dbb7..a3e29d9 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -230,7 +230,16 @@ class Product extends \yii\db\ActiveRecord public function getFullName() { - return empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; + $words = [ + 'Рюкзаки' => 'Рюкзак', + 'Несессеры' => 'Несессер', + 'Сумки' => 'Сумка', + 'Чехлы' => 'Чехол', + 'Кошельки' => 'Кошелек', + 'Гермочехлы' => 'Гермочехол', + ]; + $name = empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; + return empty($this->category->categoryName->value) ? $name : (isset($words[$this->category->categoryName->value])? $words[$this->category->categoryName->value]: '') .' '. $name; } public function getCategories() { -- libgit2 0.21.4