Commit 66285ecac41334937590e619e23c2ff71b291944

Authored by Administrator
1 parent 7253a9a0

big commti

backend/controllers/EventController.php
@@ -159,6 +159,14 @@ class EventController extends Controller @@ -159,6 +159,14 @@ class EventController extends Controller
159 return $this->redirect(['index']); 159 return $this->redirect(['index']);
160 } 160 }
161 161
  162 + public function actionDelimg($id,$field){
  163 + $model = $this->findModel($id);
  164 + $model->$field = '';
  165 + $model->save();
  166 + return true;
  167 + }
  168 +
  169 +
162 /** 170 /**
163 * Finds the Event model based on its primary key value. 171 * Finds the Event model based on its primary key value.
164 * If the model is not found, a 404 HTTP exception will be thrown. 172 * If the model is not found, a 404 HTTP exception will be thrown.
backend/views/event/_form.php
@@ -51,8 +51,9 @@ use mihaildev\elfinder\ElFinder; @@ -51,8 +51,9 @@ use mihaildev\elfinder\ElFinder;
51 'pluginOptions' => [ 51 'pluginOptions' => [
52 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 52 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
53 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', 53 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  54 + 'deleteUrl' => \yii\helpers\Url::to(['/product/manage/delimg', 'id' => $model->primaryKey]),
  55 + 'initialPreviewConfig' => $model->getImagesConfig(),
54 'overwriteInitial' => true, 56 'overwriteInitial' => true,
55 - 'showRemove' => false,  
56 'showUpload' => false, 57 'showUpload' => false,
57 'previewFileType' => 'image', 58 'previewFileType' => 'image',
58 ], 59 ],
@@ -68,8 +69,9 @@ use mihaildev\elfinder\ElFinder; @@ -68,8 +69,9 @@ use mihaildev\elfinder\ElFinder;
68 'pluginOptions' => [ 69 'pluginOptions' => [
69 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 70 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
70 'initialPreview' => !empty($model->getImageUrl('banner')) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->getImageUrl('banner'), 'list') : '', 71 'initialPreview' => !empty($model->getImageUrl('banner')) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->getImageUrl('banner'), 'list') : '',
  72 + 'deleteUrl' => \yii\helpers\Url::to(['/product/manage/delimg', 'id' => $model->primaryKey]),
  73 + 'initialPreviewConfig' => $model->getImagesConfig('banner'),
71 'overwriteInitial' => true, 74 'overwriteInitial' => true,
72 - 'showRemove' => false,  
73 'showUpload' => false, 75 'showUpload' => false,
74 'previewFileType' => 'image', 76 'previewFileType' => 'image',
75 ], 77 ],
common/behaviors/SaveImgBehavior.php
@@ -52,6 +52,23 @@ class SaveImgBehavior extends Behavior @@ -52,6 +52,23 @@ class SaveImgBehavior extends Behavior
52 52
53 } 53 }
54 54
  55 + public function getImagesConfig($image = 'image') {
  56 + $op = [];
  57 + if ($this->owner->$image) {
  58 +
  59 + $op[] = [
  60 + 'caption' => $this->owner->$image,
  61 + 'url' => \yii\helpers\Url::to(['delimg', 'id' => $this->owner->primaryKey, 'field' =>$image ]),
  62 + 'key' => $this->owner->primaryKey,
  63 + 'extra' => [
  64 + 'id' => $this->owner->primaryKey,
  65 + ],
  66 + ];
  67 +
  68 + }
  69 + return $op;
  70 + }
  71 +
55 72
56 public function beforeInsert($event) 73 public function beforeInsert($event)
57 { 74 {
common/config/main.php
@@ -157,6 +157,13 @@ return [ @@ -157,6 +157,13 @@ return [
157 'master' => null 157 'master' => null
158 ], 158 ],
159 ], 159 ],
  160 + 'banner_list' => [
  161 + 'resize' => [
  162 + 'width' => 160,
  163 + 'height' => 60,
  164 + 'master' => null
  165 + ],
  166 + ],
160 'large' => [ 167 'large' => [
161 'resize' => [ 168 'resize' => [
162 'width' => 600, 169 'width' => 600,
common/models/Event.php
@@ -91,10 +91,10 @@ class Event extends \yii\db\ActiveRecord @@ -91,10 +91,10 @@ class Event extends \yii\db\ActiveRecord
91 { 91 {
92 return [ 92 return [
93 [['body', 'seo_text'], 'string'], 93 [['body', 'seo_text'], 'string'],
94 - [['created_at', 'updated_at','percent','sale','is_event' ], 'integer'], 94 + [['created_at', 'updated_at','percent' ], 'integer'],
95 [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at','banner'], 'string', 'max' => 255], 95 [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at','banner'], 'string', 'max' => 255],
96 [['name','body'], 'required'], 96 [['name','body'], 'required'],
97 - [['imageUpload'], 'safe'], 97 + [['imageUpload','sale','is_event'], 'safe'],
98 [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], 98 [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'],
99 [['products_file'], 'file'], 99 [['products_file'], 'file'],
100 ]; 100 ];
common/modules/product/models/Import.php
@@ -248,9 +248,10 @@ class Import extends Model { @@ -248,9 +248,10 @@ class Import extends Model {
248 248
249 // 1 Группа (категория) 249 // 1 Группа (категория)
250 $catalog_names = explode(',',$data[0]); 250 $catalog_names = explode(',',$data[0]);
  251 +
251 if (empty ($catalog_names)) 252 if (empty ($catalog_names))
252 { 253 {
253 - $result_items[] = "Не указана категория (строка $j)"; 254 + $result_items[] = "Не указана категория (строка $j) ";
254 continue; 255 continue;
255 } 256 }
256 257
@@ -281,7 +282,7 @@ class Import extends Model { @@ -281,7 +282,7 @@ class Import extends Model {
281 282
282 // 11 Цена акция 283 // 11 Цена акция
283 $product_cost_old = floatval($data[7]); 284 $product_cost_old = floatval($data[7]);
284 - 285 + $product_cost = '';
285 // 10 Цена 286 // 10 Цена
286 if ($product_cost_old) { 287 if ($product_cost_old) {
287 $product_cost_old = floatval($data[6]); 288 $product_cost_old = floatval($data[6]);
@@ -315,15 +316,16 @@ class Import extends Model { @@ -315,15 +316,16 @@ class Import extends Model {
315 $product_image = explode ('=', $data[14]); 316 $product_image = explode ('=', $data[14]);
316 $product_image = @$product_image[3]; 317 $product_image = @$product_image[3];
317 318
318 - if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) { 319 + if ( ($_product = Product::find()->filterWhere(['name' => trim($product_name)])->one()) === null ) {
319 $_product = new Product(); 320 $_product = new Product();
320 } 321 }
321 322
322 $is_new_product = empty($_product->product_id); 323 $is_new_product = empty($_product->product_id);
323 - 324 + $category_id = [];
324 foreach($catalog_names as $catalog_name){ 325 foreach($catalog_names as $catalog_name){
  326 +
325 // ==== Set category ==== 327 // ==== Set category ====
326 - if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) === null ) { 328 + if ( ($category = Category::find()->filterWhere([ 'name' => trim($catalog_name)])->one()) === null ) {
327 // Create category 329 // Create category
328 $category = new Category(); 330 $category = new Category();
329 $category->name = trim($catalog_name); 331 $category->name = trim($catalog_name);
@@ -338,7 +340,7 @@ class Import extends Model { @@ -338,7 +340,7 @@ class Import extends Model {
338 340
339 // ===== Set brand ==== 341 // ===== Set brand ====
340 if ( $brand_name ) { 342 if ( $brand_name ) {
341 - if ( ($brand = Brand::find()->filterWhere(['ilike', 'name', trim($brand_name)])->one()) !== null ) { 343 + if ( ($brand = Brand::find()->filterWhere(['name' => trim($brand_name)])->one()) !== null ) {
342 $_product->brand_id = $brand->brand_id; 344 $_product->brand_id = $brand->brand_id;
343 } else { 345 } else {
344 // Create brand 346 // Create brand
@@ -368,7 +370,7 @@ class Import extends Model { @@ -368,7 +370,7 @@ class Import extends Model {
368 $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($foto); 370 $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($foto);
369 371
370 if (file_exists($source_image)) { 372 if (file_exists($source_image)) {
371 - if (($productImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $foto])->andFilterWhere(['product_id' => $_product->product_id])->one()) === null) { 373 + if (($productImage = ProductImage::find()->andFilterWhere(['image'=> $foto])->andFilterWhere(['product_id' => $_product->product_id])->one()) === null) {
372 copy($source_image, Yii::getAlias('@productsDir') . "/" . $foto); 374 copy($source_image, Yii::getAlias('@productsDir') . "/" . $foto);
373 $productImage = new ProductImage(); 375 $productImage = new ProductImage();
374 $productImage->product_id = $_product->product_id; 376 $productImage->product_id = $_product->product_id;
@@ -397,7 +399,7 @@ class Import extends Model { @@ -397,7 +399,7 @@ class Import extends Model {
397 $mod_old_cost = floatval($product_cost_old); 399 $mod_old_cost = floatval($product_cost_old);
398 400
399 // Check product variant 401 // Check product variant
400 - if ( ($_productVariant = ProductVariant::find()->andFilterWhere(['ilike', 'sku', $mod_art])->andFilterWhere(['product_id' => $_product->product_id])->one()) === null ) { 402 + if ( ($_productVariant = ProductVariant::find()->andFilterWhere([ 'sku'=> $mod_art])->andFilterWhere(['product_id' => $_product->product_id])->one()) === null ) {
401 $_productVariant = new ProductVariant(); 403 $_productVariant = new ProductVariant();
402 $_productVariant->product_id = $_product->product_id; 404 $_productVariant->product_id = $_product->product_id;
403 } 405 }
@@ -428,7 +430,7 @@ class Import extends Model { @@ -428,7 +430,7 @@ class Import extends Model {
428 430
429 // ===== Set variant type ==== 431 // ===== Set variant type ====
430 if ( $product_variant_type_name ) { 432 if ( $product_variant_type_name ) {
431 - if ( ($product_variant_type = ProductVariantType::find()->filterWhere(['ilike', 'name', $product_variant_type_name])->one()) !== null ) { 433 + if ( ($product_variant_type = ProductVariantType::find()->filterWhere([ 'name'=> $product_variant_type_name])->one()) !== null ) {
432 $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id; 434 $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
433 } else { 435 } else {
434 $product_variant_type = new ProductVariantType(); 436 $product_variant_type = new ProductVariantType();
@@ -443,10 +445,10 @@ class Import extends Model { @@ -443,10 +445,10 @@ class Import extends Model {
443 $MOD_ARRAY[] = $_productVariant->product_variant_id; 445 $MOD_ARRAY[] = $_productVariant->product_variant_id;
444 446
445 if ($mod_image) { 447 if ($mod_image) {
446 - $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($mod_image); 448 + $source_image = Yii::getAlias('@productsDir') . '/'. urlencode($mod_image);
447 if (file_exists($source_image)) { 449 if (file_exists($source_image)) {
448 - if (($variantImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) {  
449 - copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image); 450 + if (($variantImage = ProductImage::find()->andFilterWhere([ 'image' => $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) {
  451 +// copy($source_image, Yii::getAlias('@productsDir') . "/" . $mod_image);
450 $variantImage = new ProductImage(); 452 $variantImage = new ProductImage();
451 $variantImage->product_id = $_product->product_id; 453 $variantImage->product_id = $_product->product_id;
452 $variantImage->product_variant_id = $_productVariant->product_variant_id; 454 $variantImage->product_variant_id = $_productVariant->product_variant_id;
@@ -575,7 +577,7 @@ class Import extends Model { @@ -575,7 +577,7 @@ class Import extends Model {
575 $filters_options = explode(',',$filter[2][0]); 577 $filters_options = explode(',',$filter[2][0]);
576 578
577 foreach($filters_options as $filter_options){ 579 foreach($filters_options as $filter_options){
578 - $value = TaxValueString::find()->innerJoinWith('taxOption')->andFilterWhere(['ilike', 'value', $filter_options])->andFilterWhere(['tax_option.tax_group_id' => $taxGroup->tax_group_id])->one(); 580 + $value = TaxValueString::find()->innerJoinWith('taxOption')->andWhere(['value'=>$filter_options])->andWhere(['tax_option.tax_group_id' => $taxGroup->tax_group_id])->one();
579 581
580 if (!$value instanceof TaxValueString) { 582 if (!$value instanceof TaxValueString) {
581 // Create option 583 // Create option
common/modules/product/models/Product.php
@@ -37,8 +37,9 @@ use common\models\Event; @@ -37,8 +37,9 @@ use common\models\Event;
37 */ 37 */
38 class Product extends \yii\db\ActiveRecord 38 class Product extends \yii\db\ActiveRecord
39 { 39 {
40 - /** @var array $_variants */  
41 public $_variants = []; 40 public $_variants = [];
  41 + public $_categories = [];
  42 + public $_options = [];
42 43
43 /** @var array $_images */ 44 /** @var array $_images */
44 public $imagesUpload = ''; 45 public $imagesUpload = '';
@@ -77,6 +78,11 @@ class Product extends \yii\db\ActiveRecord @@ -77,6 +78,11 @@ class Product extends \yii\db\ActiveRecord
77 { 78 {
78 return '{{%product}}'; 79 return '{{%product}}';
79 } 80 }
  81 +
  82 +
  83 + /**
  84 + * @return \yii\db\ActiveQuery
  85 + */
80 public function getEvents(){ 86 public function getEvents(){
81 return $this->hasMany(Event::className(), ['event_id' => 'event_id'])->viaTable('events_to_products', ['product_id' => 'product_id']); 87 return $this->hasMany(Event::className(), ['event_id' => 'event_id'])->viaTable('events_to_products', ['product_id' => 'product_id']);
82 } 88 }
@@ -159,6 +165,7 @@ class Product extends \yii\db\ActiveRecord @@ -159,6 +165,7 @@ class Product extends \yii\db\ActiveRecord
159 return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id'])->where(['product_variant_id' => null]); 165 return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id'])->where(['product_variant_id' => null]);
160 } 166 }
161 167
  168 +
162 /** 169 /**
163 * @return \yii\db\ActiveQuery 170 * @return \yii\db\ActiveQuery
164 */ 171 */
@@ -313,21 +320,7 @@ class Product extends \yii\db\ActiveRecord @@ -313,21 +320,7 @@ class Product extends \yii\db\ActiveRecord
313 { 320 {
314 321
315 if(parent::beforeSave($insert)){ 322 if(parent::beforeSave($insert)){
316 - if(!empty($this->categories)){  
317 - $categories = Category::findAll($this->categories);  
318 - $this->unlinkAll('categories', true);  
319 - foreach($categories as $category){  
320 - $this->link('categories', $category);  
321 - }  
322 - }  
323 323
324 - if(!empty($this->options)){  
325 - $options = TaxOption::findAll($this->options);  
326 - $this->unlinkAll('options',true);  
327 - foreach($options as $option){  
328 - $this->link('options', $option);  
329 - }  
330 - }  
331 return true; 324 return true;
332 } 325 }
333 return false; 326 return false;
@@ -340,6 +333,24 @@ class Product extends \yii\db\ActiveRecord @@ -340,6 +333,24 @@ class Product extends \yii\db\ActiveRecord
340 { 333 {
341 parent::afterSave($insert, $changedAttributes); 334 parent::afterSave($insert, $changedAttributes);
342 335
  336 +
  337 + if(!empty($this->categories)){
  338 + $categories = Category::findAll($this->categories);
  339 + $this->unlinkAll('categories', true);
  340 + foreach($categories as $category){
  341 + $this->link('categories', $category);
  342 + }
  343 + }
  344 +
  345 + if(!empty($this->options)){
  346 + $options = TaxOption::findAll($this->options);
  347 + $this->unlinkAll('options',true);
  348 + foreach($options as $option){
  349 + $this->link('options', $option);
  350 + }
  351 + }
  352 +
  353 +
343 if (!empty($this->_variants)) { 354 if (!empty($this->_variants)) {
344 $todel = []; 355 $todel = [];
345 foreach ($this->variants ?: [] as $_variant) { 356 foreach ($this->variants ?: [] as $_variant) {
@@ -367,13 +378,18 @@ class Product extends \yii\db\ActiveRecord @@ -367,13 +378,18 @@ class Product extends \yii\db\ActiveRecord
367 } 378 }
368 379
369 public function beforeDelete() { 380 public function beforeDelete() {
370 - ProductImage::deleteAll(['product_id' => $this->product_id]);  
371 - ProductCategory::deleteAll(['product_id' => $this->product_id]);  
372 - ProductVariant::deleteAll(['product_id' => $this->product_id]);  
373 - ProductOption::deleteAll(['product_id' => $this->product_id]);  
374 - ProductStock::deleteAll(['product_id' => $this->product_id]);  
375 - Share::deleteAll(['product_id' => $this->product_id]);  
376 - return true; 381 + if(parent::beforeDelete()){
  382 + $this->unlinkAll('categories', true);
  383 + $this->unlinkAll('options', true);
  384 + ProductImage::deleteAll(['product_id' => $this->product_id]);
  385 +
  386 + ProductVariant::deleteAll(['product_id' => $this->product_id]);
  387 + ProductStock::deleteAll(['product_id' => $this->product_id]);
  388 + Share::deleteAll(['product_id' => $this->product_id]);
  389 + return true;
  390 + }
  391 + return false;
  392 +
377 } 393 }
378 394
379 public function imagesUpload() 395 public function imagesUpload()
common/modules/product/models/ProductVariant.php
@@ -38,6 +38,7 @@ class ProductVariant extends \yii\db\ActiveRecord @@ -38,6 +38,7 @@ class ProductVariant extends \yii\db\ActiveRecord
38 public $translit; 38 public $translit;
39 public $translit_rubric; 39 public $translit_rubric;
40 private $data; 40 private $data;
  41 + public $_options = [];
41 42
42 43
43 /** @var array $_images */ 44 /** @var array $_images */
@@ -255,8 +256,18 @@ class ProductVariant extends \yii\db\ActiveRecord @@ -255,8 +256,18 @@ class ProductVariant extends \yii\db\ActiveRecord
255 return TaxGroup::find()->distinct()->innerJoin('tax_group_to_category', 'tax_group_to_category.tax_group_id = tax_group.tax_group_id')->where(['tax_group_to_category.category_id' => $categories])->where(['level' => $level]); 256 return TaxGroup::find()->distinct()->innerJoin('tax_group_to_category', 'tax_group_to_category.tax_group_id = tax_group.tax_group_id')->where(['tax_group_to_category.category_id' => $categories])->where(['level' => $level]);
256 } 257 }
257 258
258 -// public function afterSave($insert, $changedAttributes)  
259 -// { 259 + public function afterSave($insert, $changedAttributes)
  260 + {
  261 +
  262 + if(!empty($this->_options)){
  263 + $options = TaxOption::findAll($this->_options);
  264 + $this->unlinkAll('options',true);
  265 + foreach($options as $option){
  266 + $this->link('options', $option);
  267 + }
  268 + }
  269 +
  270 +
260 // if (!is_null($this->stocks)) { 271 // if (!is_null($this->stocks)) {
261 // //ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]); 272 // //ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]);
262 // $values = []; 273 // $values = [];
@@ -266,14 +277,17 @@ class ProductVariant extends \yii\db\ActiveRecord @@ -266,14 +277,17 @@ class ProductVariant extends \yii\db\ActiveRecord
266 // $productStock->save(); 277 // $productStock->save();
267 // } 278 // }
268 // } 279 // }
269 -// parent::afterSave($insert, $changedAttributes);  
270 -// } 280 + parent::afterSave($insert, $changedAttributes);
  281 + }
271 282
272 public function beforeDelete() { 283 public function beforeDelete() {
273 - ProductVariantOption::deleteAll(['product_variant_id' => $this->product_variant_id]);  
274 - ProductImage::deleteAll(['product_variant_id' => $this->product_variant_id]);  
275 - ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]);  
276 - return true; 284 + if(parent::beforeDelete()){
  285 + ProductVariantOption::deleteAll(['product_variant_id' => $this->product_variant_id]);
  286 + ProductImage::deleteAll(['product_variant_id' => $this->product_variant_id]);
  287 + ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]);
  288 + return true;
  289 + }
  290 + return false;
277 } 291 }
278 292
279 public function imagesUpload() 293 public function imagesUpload()
frontend/config/main.php
@@ -76,6 +76,7 @@ return [ @@ -76,6 +76,7 @@ return [
76 'blog' => 'articles/index', 76 'blog' => 'articles/index',
77 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', 77 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show',
78 'event' => 'event/index', 78 'event' => 'event/index',
  79 + 'event/sale/<percent:[\d\-]+>' => 'event/sale',
79 'event/<alias:[\w\-]+>' => 'event/show', 80 'event/<alias:[\w\-]+>' => 'event/show',
80 ], 81 ],
81 'class' => 'common\components\urlManager\LangUrlManager', 82 'class' => 'common\components\urlManager\LangUrlManager',
frontend/views/catalog/_product_item.php
@@ -17,6 +17,16 @@ use yii\helpers\Url; @@ -17,6 +17,16 @@ use yii\helpers\Url;
17 'catalog/product', 17 'catalog/product',
18 'product' => $model->alias 18 'product' => $model->alias
19 ]) ?>"> 19 ]) ?>">
  20 + <?php
  21 + foreach($model->events as $event){
  22 + if($event->banner){
  23 + echo \common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'banner_list',[
  24 + 'class' => 'banner-in-list'
  25 + ]);
  26 + }
  27 + }
  28 +
  29 + ?>
20 <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [ 30 <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [
21 'alt' => $model->category->name . ' ' . $model->fullname, 31 'alt' => $model->category->name . ' ' . $model->fullname,
22 'title' => $model->category->name . ' ' . $model->fullname, 32 'title' => $model->category->name . ' ' . $model->fullname,
@@ -37,6 +47,15 @@ use yii\helpers\Url; @@ -37,6 +47,15 @@ use yii\helpers\Url;
37 </div> 47 </div>
38 </div> 48 </div>
39 <div class="price"> 49 <div class="price">
  50 +
  51 + <?php if($model->variant->price_old){?>
  52 + <div class="dlexfduinxipi">
  53 + <span class="main">
  54 + <s><?= $model->variant->price_old ?>
  55 + <span class="currency">грн</span><s>
  56 + </span>
  57 + </div>
  58 + <?php }?>
40 <div class="dlexfduinxipi"> 59 <div class="dlexfduinxipi">
41 Цена: 60 Цена:
42 <span class="main"> 61 <span class="main">
frontend/views/catalog/product.php
@@ -207,7 +207,7 @@ FlipclockAsset::register($this); @@ -207,7 +207,7 @@ FlipclockAsset::register($this);
207 — Самовывоз Новая Почта - 55 грн.<br> 207 — Самовывоз Новая Почта - 55 грн.<br>
208 — Курьер Новая Почта - 88 грн.<br> 208 — Курьер Новая Почта - 88 грн.<br>
209 — Курьер «ИнТайм» - 60 грн.</p> 209 — Курьер «ИнТайм» - 60 грн.</p>
210 - <?php if($product->variant->price > 1000){?> 210 + <?php if($product->variant->price >= 1000){?>
211 <p> 211 <p>
212 <span class="strong black">Киев</span>:<br> 212 <span class="strong black">Киев</span>:<br>
213 — Курьер - <s>50 грн.</s> 213 — Курьер - <s>50 грн.</s>
frontend/views/layouts/main.php
@@ -23,10 +23,9 @@ use common\models\Event; @@ -23,10 +23,9 @@ use common\models\Event;
23 23
24 <meta charset="<?= Yii::$app->charset ?>"/> 24 <meta charset="<?= Yii::$app->charset ?>"/>
25 <?= Html::csrfMetaTags () ?> 25 <?= Html::csrfMetaTags () ?>
26 - <meta name="robots" content="noindex,nofollow">  
27 - <?php /*?><title><?= Seo::widget([ 'row'=>'title'])?></title> 26 + <title><?= Seo::widget([ 'row'=>'title'])?></title>
28 <?= Seo::widget([ 'row'=>'description'])?> 27 <?= Seo::widget([ 'row'=>'description'])?>
29 - <?= Seo::widget([ 'row'=>'meta'])?> */?> 28 + <?= Seo::widget([ 'row'=>'meta'])?>
30 <link rel="icon" type="image/vnd.microsoft.icon" href="/images/icon.ico"/> 29 <link rel="icon" type="image/vnd.microsoft.icon" href="/images/icon.ico"/>
31 <link type="image/ico" href="http://www.linija-svitla.ua/images/icon.ico" rel="SHORTCUT ICON"/> 30 <link type="image/ico" href="http://www.linija-svitla.ua/images/icon.ico" rel="SHORTCUT ICON"/>
32 <link rel="icon" href="http://www.linija-svitla.ua/images/icon.ico" type="image/x-icon"/> 31 <link rel="icon" href="http://www.linija-svitla.ua/images/icon.ico" type="image/x-icon"/>
frontend/views/search/_product_search_item.php deleted
1 -<?php  
2 - /**  
3 - * @var $model common\modules\product\models\Product  
4 - */  
5 -use yii\helpers\Html;  
6 -use yii\helpers\Url;  
7 -?>  
8 -<div class="catalog_item">  
9 - <div class="wrapper">  
10 - <div class="item_container" >  
11 - <input class="prodInfo" type="hidden" value="[]">  
12 - <div class="title">  
13 - <?= Html::a( $model->name, Url::to(['catalog/product', 'product' => $model->alias]), ['class'=>'btn-product-details'] )?>  
14 - </div>  
15 - <div class="img">  
16 - <a class="btn-product-details" href="<?= Url::to([  
17 - 'catalog/product',  
18 - 'product' => $model->alias  
19 - ]) ?>">  
20 - <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [  
21 - 'alt' => $model->category->name . ' ' . $model->fullname,  
22 - 'title' => $model->category->name . ' ' . $model->fullname,  
23 - 'class' => 'selected'  
24 - ]) ?>  
25 - </a>  
26 - <div class="info_icons">  
27 - <a href="#" class="btn buy_button" data-toggle="modal" data-target="#buyForm" data-id="<?=$model->variant->product_variant_id; ?>" lang="145">Купить</a>  
28 - <ul class="ul wishlike_block hidden">  
29 - <li class="compare hidden">  
30 - <a onclick="add2compare(); return false;" class="compare compare_text_link_3631483" href="#">К сравнению</a>  
31 - <span class="icon"></span>  
32 - </li>  
33 - <li class="like hidden">  
34 - <a class="like like_text_link_3631483" href="#">В избранное</a><span class="icon"></span>  
35 - </li>  
36 - </ul>  
37 - </div>  
38 - </div>  
39 - <div class="price">  
40 - <div class="dlexfduinxipi">  
41 - Цена:  
42 - <span class="main">  
43 - <?= $model->variant->price ?>  
44 - <span class="currency">грн</span>  
45 - </span>  
46 - </div>  
47 - </div>  
48 - <div class="additional_info params">  
49 - <div class="block_title">Особенности</div>  
50 - <div class="descr">  
51 - <div class="info">  
52 - <ul class="sv">  
53 -  
54 - <li><span>Бренд:</span> <?= $model->brand->name ?></li>  
55 -  
56 - <?php foreach($model->getActiveProperties($model->category->category_id) as $group): ?>  
57 - <li><span><?= $group->name ?> <?php foreach($group->_options as $option) : ?>&nbsp;</span><?= $option->ValueRenderHTML ?><?php endforeach ?></li>  
58 - <?php endforeach; ?>  
59 -  
60 -  
61 - </ul>  
62 - </div>  
63 - <div class="clearfix"></div>  
64 - </div>  
65 - <div class="price" style="display: none;">  
66 - <div class="dlexfduinxipi">  
67 - Цена:  
68 - <span class="main">  
69 - <?php  
70 -  
71 - echo '<div class="cost-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer">';  
72 -  
73 - // есть скидка  
74 - echo '<p class="cost">';  
75 - if($model->enabledVariants[ 0 ]->price_old != 0 && $model->enabledVariants[ 0 ]->price_old != $model->enabledVariants[ 0 ]->price) {  
76 - echo '<strike><span id=\'old_cost\' itemprop="price">' . $model->enabledVariants[0]->price_old . '</span> грн.</strike>&nbsp;';  
77 - echo $model->enabledVariants[0]->price . ' <span>грн.</span></p>';  
78 - } else {  
79 - echo '<span itemprop="price">'.$model->enabledVariants[0]->price . ' </span><span>грн.</span></p>';  
80 - }  
81 - echo '<meta itemprop="priceCurrency" content = "UAH">';  
82 - echo '</div>';  
83 -  
84 - ?>  
85 - </span>  
86 - </div>  
87 - </div>  
88 - </div>  
89 - <div class="opacity_bg"></div>  
90 - </div>  
91 - </div>  
92 -</div>  
93 \ No newline at end of file 0 \ No newline at end of file
frontend/views/search/index.php
@@ -84,8 +84,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = &#39;Поиск&#39;; @@ -84,8 +84,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = &#39;Поиск&#39;;
84 <?= ListView::widget([ 84 <?= ListView::widget([
85 'dataProvider' => $productProvider, 85 'dataProvider' => $productProvider,
86 'itemView' => function ($model, $key, $index, $widget) { 86 'itemView' => function ($model, $key, $index, $widget) {
87 - return $this->render('_product_search_item',[  
88 - 'model' => $model 87 + return $this->render('../catalog/_product_item',[
  88 + 'model' => $model,
  89 + 'category' => $model->category
89 ]); 90 ]);
90 }, 91 },
91 'layout' => "{items}<div class=\"clearfix\"></div>{pager}", 92 'layout' => "{items}<div class=\"clearfix\"></div>{pager}",
frontend/web/css/css_header.css
@@ -14544,4 +14544,8 @@ ul.product-special li.promo div{ @@ -14544,4 +14544,8 @@ ul.product-special li.promo div{
14544 -ms-filter: grayscale(0%); 14544 -ms-filter: grayscale(0%);
14545 -o-filter: grayscale(0%); 14545 -o-filter: grayscale(0%);
14546 -moz-filter: grayscale(0%); 14546 -moz-filter: grayscale(0%);
  14547 +}
  14548 +
  14549 +.banner-in-list{
  14550 + margin: 0 !important;
14547 } 14551 }
14548 \ No newline at end of file 14552 \ No newline at end of file