diff --git a/common/modules/product/models/Export.php b/common/modules/product/models/Export.php index aec770f..f276307 100755 --- a/common/modules/product/models/Export.php +++ b/common/modules/product/models/Export.php @@ -16,7 +16,7 @@ if(is_null($filename)) { $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; } - setlocale(LC_ALL, 'ru_RU.CP1251'); +// setlocale(LC_ALL, 'ru_RU.UTF-8'); $handle = fopen($dirName . '/' . $filename, "w"); $products = Product::find() ->joinWith([ @@ -47,7 +47,7 @@ $list = [ $categories, - $product->brand->name, + (!empty($product->brand->name) ? $product->brand->name : ''), $product->name, '', ( ( !empty( $product->description ) ) ? $product->description : '' ), @@ -62,9 +62,7 @@ implode(',', $fotos), ]; $to_write = array_merge($list, $mods); - foreach($to_write as &$cell) { - $cell = iconv("UTF-8", "WINDOWS-1251", $cell); - } + fputcsv($handle, $to_write, ';'); unset( $product ); } diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php index 62934b0..ab8b4b9 100755 --- a/common/modules/product/models/Import.php +++ b/common/modules/product/models/Import.php @@ -61,7 +61,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) { @@ -180,7 +180,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) { foreach ($data as &$value) { @@ -284,7 +284,7 @@ class Import extends Model { $category_id[] = $category->category_id; } - $_product->categories = $category_id; + $_product->_categories = $category_id; // ===== Set brand ==== if ( $brand_name ) { @@ -366,7 +366,7 @@ class Import extends Model { if (isset($variants_options) && !empty($variants_options)) { - $_productVariant->options = $variants_options; + $_productVariant->_options = $variants_options; } $_productVariant->save(false); @@ -397,7 +397,7 @@ class Import extends Model { if (isset($options) && !empty($options)) { - $_product->options = $options; + $_product->_options = $options; } $_product->save(); @@ -471,7 +471,7 @@ class Import extends Model { $filters_options = explode(',',$filter[2][0]); foreach($filters_options as $filter_options){ - $option = TaxOption::find()->andFilterWhere(['ilike', 'value', $filters_options])->andFilterWhere(['tax_group_id' => $taxGroup->tax_group_id])->one(); + $option = TaxOption::find()->andWhere(['value' => $filters_options])->andFilterWhere(['tax_group_id' => $taxGroup->tax_group_id])->one(); if ($option === NULL) { // Create option diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index 02a78ba..2fc0c5d 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -39,12 +39,24 @@ * @property string $alias * @property string $size * @property string $material + * @property array $_categories + * @property array $_options */ class Product extends \yii\db\ActiveRecord { /** @var array $_variants */ public $_variants = []; + + /** + * @var array $_categories + */ + public $_categories = []; + + /** + * @var array $_options + */ + public $_options = []; /** @var array $_images */ public $imagesUpload = ''; @@ -363,8 +375,8 @@ $this->unlinkAll('categories', true); $this->unlinkAll('options', true); - $categories = Category::findAll($this->categories); - $options = TaxOption::findAll($this->options); + $categories = Category::findAll($this->_categories); + $options = TaxOption::findAll($this->_options); foreach($options as $option) { $this->link('options', $option); diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php index 9562033..08d761d 100755 --- a/common/modules/product/models/ProductVariant.php +++ b/common/modules/product/models/ProductVariant.php @@ -32,6 +32,11 @@ public $sum_cost; public $product_name; + + /** + * @var array $_options + */ + public $_options = []; //public $image; public $translit; @@ -312,7 +317,7 @@ { parent::afterSave($insert, $changedAttributes); $this->unlinkAll('options', true); - $options = TaxOption::findAll($this->options); + $options = TaxOption::findAll($this->_options); foreach($options as $option) { $this->link('options', $option); } diff --git a/frontend/views/comments/index.php b/frontend/views/comments/index.php index 273c8c2..d407ef6 100755 --- a/frontend/views/comments/index.php +++ b/frontend/views/comments/index.php @@ -1,14 +1,17 @@ title = 'Отзывы'; + $this->params['breadcrumbs'][] = $this->title; ?> -
Отзывы
-- libgit2 0.21.4