Commit 0a24a6acfae8c62b74a017a46be5897d07fac7f1
1 parent
8813e60c
-Comments breadcrumbs
-Export changes
Showing
5 changed files
with
33 additions
and
15 deletions
Show diff stats
common/modules/product/models/Export.php
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | if(is_null($filename)) { | 16 | if(is_null($filename)) { |
17 | $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; | 17 | $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; |
18 | } | 18 | } |
19 | - setlocale(LC_ALL, 'ru_RU.CP1251'); | 19 | +// setlocale(LC_ALL, 'ru_RU.UTF-8'); |
20 | $handle = fopen($dirName . '/' . $filename, "w"); | 20 | $handle = fopen($dirName . '/' . $filename, "w"); |
21 | $products = Product::find() | 21 | $products = Product::find() |
22 | ->joinWith([ | 22 | ->joinWith([ |
@@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
47 | 47 | ||
48 | $list = [ | 48 | $list = [ |
49 | $categories, | 49 | $categories, |
50 | - $product->brand->name, | 50 | + (!empty($product->brand->name) ? $product->brand->name : ''), |
51 | $product->name, | 51 | $product->name, |
52 | '', | 52 | '', |
53 | ( ( !empty( $product->description ) ) ? $product->description : '' ), | 53 | ( ( !empty( $product->description ) ) ? $product->description : '' ), |
@@ -62,9 +62,7 @@ | @@ -62,9 +62,7 @@ | ||
62 | implode(',', $fotos), | 62 | implode(',', $fotos), |
63 | ]; | 63 | ]; |
64 | $to_write = array_merge($list, $mods); | 64 | $to_write = array_merge($list, $mods); |
65 | - foreach($to_write as &$cell) { | ||
66 | - $cell = iconv("UTF-8", "WINDOWS-1251", $cell); | ||
67 | - } | 65 | + |
68 | fputcsv($handle, $to_write, ';'); | 66 | fputcsv($handle, $to_write, ';'); |
69 | unset( $product ); | 67 | unset( $product ); |
70 | } | 68 | } |
common/modules/product/models/Import.php
@@ -61,7 +61,7 @@ class Import extends Model { | @@ -61,7 +61,7 @@ class Import extends Model { | ||
61 | 61 | ||
62 | $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); | 62 | $is_utf = (preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFilePrices'), null, null, null, 1000000))); |
63 | 63 | ||
64 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | 64 | + while ((empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE) |
65 | { | 65 | { |
66 | foreach ($data as &$value) | 66 | foreach ($data as &$value) |
67 | { | 67 | { |
@@ -180,7 +180,7 @@ class Import extends Model { | @@ -180,7 +180,7 @@ class Import extends Model { | ||
180 | 180 | ||
181 | $result_items = []; | 181 | $result_items = []; |
182 | 182 | ||
183 | - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE && (empty($limit) || $j++ < $limit)) | 183 | + while ((empty($limit) || $j++ < $limit) && ($data = fgetcsv ($handle, 10000, ";")) !== FALSE) |
184 | { | 184 | { |
185 | foreach ($data as &$value) | 185 | foreach ($data as &$value) |
186 | { | 186 | { |
@@ -284,7 +284,7 @@ class Import extends Model { | @@ -284,7 +284,7 @@ class Import extends Model { | ||
284 | $category_id[] = $category->category_id; | 284 | $category_id[] = $category->category_id; |
285 | } | 285 | } |
286 | 286 | ||
287 | - $_product->categories = $category_id; | 287 | + $_product->_categories = $category_id; |
288 | 288 | ||
289 | // ===== Set brand ==== | 289 | // ===== Set brand ==== |
290 | if ( $brand_name ) { | 290 | if ( $brand_name ) { |
@@ -366,7 +366,7 @@ class Import extends Model { | @@ -366,7 +366,7 @@ class Import extends Model { | ||
366 | 366 | ||
367 | 367 | ||
368 | if (isset($variants_options) && !empty($variants_options)) { | 368 | if (isset($variants_options) && !empty($variants_options)) { |
369 | - $_productVariant->options = $variants_options; | 369 | + $_productVariant->_options = $variants_options; |
370 | } | 370 | } |
371 | 371 | ||
372 | $_productVariant->save(false); | 372 | $_productVariant->save(false); |
@@ -397,7 +397,7 @@ class Import extends Model { | @@ -397,7 +397,7 @@ class Import extends Model { | ||
397 | 397 | ||
398 | 398 | ||
399 | if (isset($options) && !empty($options)) { | 399 | if (isset($options) && !empty($options)) { |
400 | - $_product->options = $options; | 400 | + $_product->_options = $options; |
401 | } | 401 | } |
402 | 402 | ||
403 | $_product->save(); | 403 | $_product->save(); |
@@ -471,7 +471,7 @@ class Import extends Model { | @@ -471,7 +471,7 @@ class Import extends Model { | ||
471 | $filters_options = explode(',',$filter[2][0]); | 471 | $filters_options = explode(',',$filter[2][0]); |
472 | 472 | ||
473 | foreach($filters_options as $filter_options){ | 473 | foreach($filters_options as $filter_options){ |
474 | - $option = TaxOption::find()->andFilterWhere(['ilike', 'value', $filters_options])->andFilterWhere(['tax_group_id' => $taxGroup->tax_group_id])->one(); | 474 | + $option = TaxOption::find()->andWhere(['value' => $filters_options])->andFilterWhere(['tax_group_id' => $taxGroup->tax_group_id])->one(); |
475 | 475 | ||
476 | if ($option === NULL) { | 476 | if ($option === NULL) { |
477 | // Create option | 477 | // Create option |
common/modules/product/models/Product.php
@@ -39,12 +39,24 @@ | @@ -39,12 +39,24 @@ | ||
39 | * @property string $alias | 39 | * @property string $alias |
40 | * @property string $size | 40 | * @property string $size |
41 | * @property string $material | 41 | * @property string $material |
42 | + * @property array $_categories | ||
43 | + * @property array $_options | ||
42 | */ | 44 | */ |
43 | class Product extends \yii\db\ActiveRecord | 45 | class Product extends \yii\db\ActiveRecord |
44 | { | 46 | { |
45 | 47 | ||
46 | /** @var array $_variants */ | 48 | /** @var array $_variants */ |
47 | public $_variants = []; | 49 | public $_variants = []; |
50 | + | ||
51 | + /** | ||
52 | + * @var array $_categories | ||
53 | + */ | ||
54 | + public $_categories = []; | ||
55 | + | ||
56 | + /** | ||
57 | + * @var array $_options | ||
58 | + */ | ||
59 | + public $_options = []; | ||
48 | 60 | ||
49 | /** @var array $_images */ | 61 | /** @var array $_images */ |
50 | public $imagesUpload = ''; | 62 | public $imagesUpload = ''; |
@@ -363,8 +375,8 @@ | @@ -363,8 +375,8 @@ | ||
363 | $this->unlinkAll('categories', true); | 375 | $this->unlinkAll('categories', true); |
364 | $this->unlinkAll('options', true); | 376 | $this->unlinkAll('options', true); |
365 | 377 | ||
366 | - $categories = Category::findAll($this->categories); | ||
367 | - $options = TaxOption::findAll($this->options); | 378 | + $categories = Category::findAll($this->_categories); |
379 | + $options = TaxOption::findAll($this->_options); | ||
368 | 380 | ||
369 | foreach($options as $option) { | 381 | foreach($options as $option) { |
370 | $this->link('options', $option); | 382 | $this->link('options', $option); |
common/modules/product/models/ProductVariant.php
@@ -32,6 +32,11 @@ | @@ -32,6 +32,11 @@ | ||
32 | public $sum_cost; | 32 | public $sum_cost; |
33 | 33 | ||
34 | public $product_name; | 34 | public $product_name; |
35 | + | ||
36 | + /** | ||
37 | + * @var array $_options | ||
38 | + */ | ||
39 | + public $_options = []; | ||
35 | 40 | ||
36 | //public $image; | 41 | //public $image; |
37 | public $translit; | 42 | public $translit; |
@@ -312,7 +317,7 @@ | @@ -312,7 +317,7 @@ | ||
312 | { | 317 | { |
313 | parent::afterSave($insert, $changedAttributes); | 318 | parent::afterSave($insert, $changedAttributes); |
314 | $this->unlinkAll('options', true); | 319 | $this->unlinkAll('options', true); |
315 | - $options = TaxOption::findAll($this->options); | 320 | + $options = TaxOption::findAll($this->_options); |
316 | foreach($options as $option) { | 321 | foreach($options as $option) { |
317 | $this->link('options', $option); | 322 | $this->link('options', $option); |
318 | } | 323 | } |
frontend/views/comments/index.php
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | * @var Comments $comments | 3 | * @var Comments $comments |
4 | + * @var View $this | ||
4 | */ | 5 | */ |
5 | use common\models\Comments; | 6 | use common\models\Comments; |
6 | use common\modules\comment\widgets\CommentWidget; | 7 | use common\modules\comment\widgets\CommentWidget; |
8 | + use yii\web\View; | ||
7 | 9 | ||
10 | + $this->title = 'Отзывы'; | ||
11 | + $this->params['breadcrumbs'][] = $this->title; | ||
8 | ?> | 12 | ?> |
9 | 13 | ||
10 | 14 | ||
11 | -<div class="nav_up"><a href="/">Главная</a> - <span>Новые коллекции</span></div> | ||
12 | <div class="otzivi_block"> | 15 | <div class="otzivi_block"> |
13 | <div class="title9">Отзывы</div> | 16 | <div class="title9">Отзывы</div> |
14 | <div class="start_otzivi"> | 17 | <div class="start_otzivi"> |