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 | 16 | if(is_null($filename)) { |
| 17 | 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 | 20 | $handle = fopen($dirName . '/' . $filename, "w"); |
| 21 | 21 | $products = Product::find() |
| 22 | 22 | ->joinWith([ |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | |
| 48 | 48 | $list = [ |
| 49 | 49 | $categories, |
| 50 | - $product->brand->name, | |
| 50 | + (!empty($product->brand->name) ? $product->brand->name : ''), | |
| 51 | 51 | $product->name, |
| 52 | 52 | '', |
| 53 | 53 | ( ( !empty( $product->description ) ) ? $product->description : '' ), |
| ... | ... | @@ -62,9 +62,7 @@ |
| 62 | 62 | implode(',', $fotos), |
| 63 | 63 | ]; |
| 64 | 64 | $to_write = array_merge($list, $mods); |
| 65 | - foreach($to_write as &$cell) { | |
| 66 | - $cell = iconv("UTF-8", "WINDOWS-1251", $cell); | |
| 67 | - } | |
| 65 | + | |
| 68 | 66 | fputcsv($handle, $to_write, ';'); |
| 69 | 67 | unset( $product ); |
| 70 | 68 | } | ... | ... |
common/modules/product/models/Import.php
| ... | ... | @@ -61,7 +61,7 @@ class Import extends Model { |
| 61 | 61 | |
| 62 | 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 | 66 | foreach ($data as &$value) |
| 67 | 67 | { |
| ... | ... | @@ -180,7 +180,7 @@ class Import extends Model { |
| 180 | 180 | |
| 181 | 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 | 185 | foreach ($data as &$value) |
| 186 | 186 | { |
| ... | ... | @@ -284,7 +284,7 @@ class Import extends Model { |
| 284 | 284 | $category_id[] = $category->category_id; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $_product->categories = $category_id; | |
| 287 | + $_product->_categories = $category_id; | |
| 288 | 288 | |
| 289 | 289 | // ===== Set brand ==== |
| 290 | 290 | if ( $brand_name ) { |
| ... | ... | @@ -366,7 +366,7 @@ class Import extends Model { |
| 366 | 366 | |
| 367 | 367 | |
| 368 | 368 | if (isset($variants_options) && !empty($variants_options)) { |
| 369 | - $_productVariant->options = $variants_options; | |
| 369 | + $_productVariant->_options = $variants_options; | |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $_productVariant->save(false); |
| ... | ... | @@ -397,7 +397,7 @@ class Import extends Model { |
| 397 | 397 | |
| 398 | 398 | |
| 399 | 399 | if (isset($options) && !empty($options)) { |
| 400 | - $_product->options = $options; | |
| 400 | + $_product->_options = $options; | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | $_product->save(); |
| ... | ... | @@ -471,7 +471,7 @@ class Import extends Model { |
| 471 | 471 | $filters_options = explode(',',$filter[2][0]); |
| 472 | 472 | |
| 473 | 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 | 476 | if ($option === NULL) { |
| 477 | 477 | // Create option | ... | ... |
common/modules/product/models/Product.php
| ... | ... | @@ -39,12 +39,24 @@ |
| 39 | 39 | * @property string $alias |
| 40 | 40 | * @property string $size |
| 41 | 41 | * @property string $material |
| 42 | + * @property array $_categories | |
| 43 | + * @property array $_options | |
| 42 | 44 | */ |
| 43 | 45 | class Product extends \yii\db\ActiveRecord |
| 44 | 46 | { |
| 45 | 47 | |
| 46 | 48 | /** @var array $_variants */ |
| 47 | 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 | 61 | /** @var array $_images */ |
| 50 | 62 | public $imagesUpload = ''; |
| ... | ... | @@ -363,8 +375,8 @@ |
| 363 | 375 | $this->unlinkAll('categories', true); |
| 364 | 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 | 381 | foreach($options as $option) { |
| 370 | 382 | $this->link('options', $option); | ... | ... |
common/modules/product/models/ProductVariant.php
| ... | ... | @@ -32,6 +32,11 @@ |
| 32 | 32 | public $sum_cost; |
| 33 | 33 | |
| 34 | 34 | public $product_name; |
| 35 | + | |
| 36 | + /** | |
| 37 | + * @var array $_options | |
| 38 | + */ | |
| 39 | + public $_options = []; | |
| 35 | 40 | |
| 36 | 41 | //public $image; |
| 37 | 42 | public $translit; |
| ... | ... | @@ -312,7 +317,7 @@ |
| 312 | 317 | { |
| 313 | 318 | parent::afterSave($insert, $changedAttributes); |
| 314 | 319 | $this->unlinkAll('options', true); |
| 315 | - $options = TaxOption::findAll($this->options); | |
| 320 | + $options = TaxOption::findAll($this->_options); | |
| 316 | 321 | foreach($options as $option) { |
| 317 | 322 | $this->link('options', $option); |
| 318 | 323 | } | ... | ... |
frontend/views/comments/index.php
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @var Comments $comments |
| 4 | + * @var View $this | |
| 4 | 5 | */ |
| 5 | 6 | use common\models\Comments; |
| 6 | 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 | 15 | <div class="otzivi_block"> |
| 13 | 16 | <div class="title9">Отзывы</div> |
| 14 | 17 | <div class="start_otzivi"> | ... | ... |