Commit 66285ecac41334937590e619e23c2ff71b291944
1 parent
7253a9a0
big commti
Showing
15 changed files
with
143 additions
and
145 deletions
Show diff stats
backend/controllers/EventController.php
| ... | ... | @@ -159,6 +159,14 @@ class EventController extends Controller |
| 159 | 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 | 171 | * Finds the Event model based on its primary key value. |
| 164 | 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 | 51 | 'pluginOptions' => [ |
| 52 | 52 | 'allowedFileExtensions' => ['jpg', 'gif', 'png'], |
| 53 | 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 | 56 | 'overwriteInitial' => true, |
| 55 | - 'showRemove' => false, | |
| 56 | 57 | 'showUpload' => false, |
| 57 | 58 | 'previewFileType' => 'image', |
| 58 | 59 | ], |
| ... | ... | @@ -68,8 +69,9 @@ use mihaildev\elfinder\ElFinder; |
| 68 | 69 | 'pluginOptions' => [ |
| 69 | 70 | 'allowedFileExtensions' => ['jpg', 'gif', 'png'], |
| 70 | 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 | 74 | 'overwriteInitial' => true, |
| 72 | - 'showRemove' => false, | |
| 73 | 75 | 'showUpload' => false, |
| 74 | 76 | 'previewFileType' => 'image', |
| 75 | 77 | ], | ... | ... |
common/behaviors/SaveImgBehavior.php
| ... | ... | @@ -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 | 73 | public function beforeInsert($event) |
| 57 | 74 | { | ... | ... |
common/config/main.php
common/models/Event.php
| ... | ... | @@ -91,10 +91,10 @@ class Event extends \yii\db\ActiveRecord |
| 91 | 91 | { |
| 92 | 92 | return [ |
| 93 | 93 | [['body', 'seo_text'], 'string'], |
| 94 | - [['created_at', 'updated_at','percent','sale','is_event' ], 'integer'], | |
| 94 | + [['created_at', 'updated_at','percent' ], 'integer'], | |
| 95 | 95 | [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at','banner'], 'string', 'max' => 255], |
| 96 | 96 | [['name','body'], 'required'], |
| 97 | - [['imageUpload'], 'safe'], | |
| 97 | + [['imageUpload','sale','is_event'], 'safe'], | |
| 98 | 98 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], |
| 99 | 99 | [['products_file'], 'file'], |
| 100 | 100 | ]; | ... | ... |
common/modules/product/models/Import.php
| ... | ... | @@ -248,9 +248,10 @@ class Import extends Model { |
| 248 | 248 | |
| 249 | 249 | // 1 Группа (категория) |
| 250 | 250 | $catalog_names = explode(',',$data[0]); |
| 251 | + | |
| 251 | 252 | if (empty ($catalog_names)) |
| 252 | 253 | { |
| 253 | - $result_items[] = "Не указана категория (строка $j)"; | |
| 254 | + $result_items[] = "Не указана категория (строка $j) "; | |
| 254 | 255 | continue; |
| 255 | 256 | } |
| 256 | 257 | |
| ... | ... | @@ -281,7 +282,7 @@ class Import extends Model { |
| 281 | 282 | |
| 282 | 283 | // 11 Цена акция |
| 283 | 284 | $product_cost_old = floatval($data[7]); |
| 284 | - | |
| 285 | + $product_cost = ''; | |
| 285 | 286 | // 10 Цена |
| 286 | 287 | if ($product_cost_old) { |
| 287 | 288 | $product_cost_old = floatval($data[6]); |
| ... | ... | @@ -315,15 +316,16 @@ class Import extends Model { |
| 315 | 316 | $product_image = explode ('=', $data[14]); |
| 316 | 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 | 320 | $_product = new Product(); |
| 320 | 321 | } |
| 321 | 322 | |
| 322 | 323 | $is_new_product = empty($_product->product_id); |
| 323 | - | |
| 324 | + $category_id = []; | |
| 324 | 325 | foreach($catalog_names as $catalog_name){ |
| 326 | + | |
| 325 | 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 | 329 | // Create category |
| 328 | 330 | $category = new Category(); |
| 329 | 331 | $category->name = trim($catalog_name); |
| ... | ... | @@ -338,7 +340,7 @@ class Import extends Model { |
| 338 | 340 | |
| 339 | 341 | // ===== Set brand ==== |
| 340 | 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 | 344 | $_product->brand_id = $brand->brand_id; |
| 343 | 345 | } else { |
| 344 | 346 | // Create brand |
| ... | ... | @@ -368,7 +370,7 @@ class Import extends Model { |
| 368 | 370 | $source_image = Yii::getAlias('@uploadDir') . '/product_images/'. urlencode($foto); |
| 369 | 371 | |
| 370 | 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 | 374 | copy($source_image, Yii::getAlias('@productsDir') . "/" . $foto); |
| 373 | 375 | $productImage = new ProductImage(); |
| 374 | 376 | $productImage->product_id = $_product->product_id; |
| ... | ... | @@ -397,7 +399,7 @@ class Import extends Model { |
| 397 | 399 | $mod_old_cost = floatval($product_cost_old); |
| 398 | 400 | |
| 399 | 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 | 403 | $_productVariant = new ProductVariant(); |
| 402 | 404 | $_productVariant->product_id = $_product->product_id; |
| 403 | 405 | } |
| ... | ... | @@ -428,7 +430,7 @@ class Import extends Model { |
| 428 | 430 | |
| 429 | 431 | // ===== Set variant type ==== |
| 430 | 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 | 434 | $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id; |
| 433 | 435 | } else { |
| 434 | 436 | $product_variant_type = new ProductVariantType(); |
| ... | ... | @@ -443,10 +445,10 @@ class Import extends Model { |
| 443 | 445 | $MOD_ARRAY[] = $_productVariant->product_variant_id; |
| 444 | 446 | |
| 445 | 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 | 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 | 452 | $variantImage = new ProductImage(); |
| 451 | 453 | $variantImage->product_id = $_product->product_id; |
| 452 | 454 | $variantImage->product_variant_id = $_productVariant->product_variant_id; |
| ... | ... | @@ -575,7 +577,7 @@ class Import extends Model { |
| 575 | 577 | $filters_options = explode(',',$filter[2][0]); |
| 576 | 578 | |
| 577 | 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 | 582 | if (!$value instanceof TaxValueString) { |
| 581 | 583 | // Create option | ... | ... |
common/modules/product/models/Product.php
| ... | ... | @@ -37,8 +37,9 @@ use common\models\Event; |
| 37 | 37 | */ |
| 38 | 38 | class Product extends \yii\db\ActiveRecord |
| 39 | 39 | { |
| 40 | - /** @var array $_variants */ | |
| 41 | 40 | public $_variants = []; |
| 41 | + public $_categories = []; | |
| 42 | + public $_options = []; | |
| 42 | 43 | |
| 43 | 44 | /** @var array $_images */ |
| 44 | 45 | public $imagesUpload = ''; |
| ... | ... | @@ -77,6 +78,11 @@ class Product extends \yii\db\ActiveRecord |
| 77 | 78 | { |
| 78 | 79 | return '{{%product}}'; |
| 79 | 80 | } |
| 81 | + | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * @return \yii\db\ActiveQuery | |
| 85 | + */ | |
| 80 | 86 | public function getEvents(){ |
| 81 | 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 | 165 | return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id'])->where(['product_variant_id' => null]); |
| 160 | 166 | } |
| 161 | 167 | |
| 168 | + | |
| 162 | 169 | /** |
| 163 | 170 | * @return \yii\db\ActiveQuery |
| 164 | 171 | */ |
| ... | ... | @@ -313,21 +320,7 @@ class Product extends \yii\db\ActiveRecord |
| 313 | 320 | { |
| 314 | 321 | |
| 315 | 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 | 324 | return true; |
| 332 | 325 | } |
| 333 | 326 | return false; |
| ... | ... | @@ -340,6 +333,24 @@ class Product extends \yii\db\ActiveRecord |
| 340 | 333 | { |
| 341 | 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 | 354 | if (!empty($this->_variants)) { |
| 344 | 355 | $todel = []; |
| 345 | 356 | foreach ($this->variants ?: [] as $_variant) { |
| ... | ... | @@ -367,13 +378,18 @@ class Product extends \yii\db\ActiveRecord |
| 367 | 378 | } |
| 368 | 379 | |
| 369 | 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 | 395 | public function imagesUpload() | ... | ... |
common/modules/product/models/ProductVariant.php
| ... | ... | @@ -38,6 +38,7 @@ class ProductVariant extends \yii\db\ActiveRecord |
| 38 | 38 | public $translit; |
| 39 | 39 | public $translit_rubric; |
| 40 | 40 | private $data; |
| 41 | + public $_options = []; | |
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | /** @var array $_images */ |
| ... | ... | @@ -255,8 +256,18 @@ class ProductVariant extends \yii\db\ActiveRecord |
| 255 | 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 | 271 | // if (!is_null($this->stocks)) { |
| 261 | 272 | // //ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]); |
| 262 | 273 | // $values = []; |
| ... | ... | @@ -266,14 +277,17 @@ class ProductVariant extends \yii\db\ActiveRecord |
| 266 | 277 | // $productStock->save(); |
| 267 | 278 | // } |
| 268 | 279 | // } |
| 269 | -// parent::afterSave($insert, $changedAttributes); | |
| 270 | -// } | |
| 280 | + parent::afterSave($insert, $changedAttributes); | |
| 281 | + } | |
| 271 | 282 | |
| 272 | 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 | 293 | public function imagesUpload() | ... | ... |
frontend/config/main.php
| ... | ... | @@ -76,6 +76,7 @@ return [ |
| 76 | 76 | 'blog' => 'articles/index', |
| 77 | 77 | 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', |
| 78 | 78 | 'event' => 'event/index', |
| 79 | + 'event/sale/<percent:[\d\-]+>' => 'event/sale', | |
| 79 | 80 | 'event/<alias:[\w\-]+>' => 'event/show', |
| 80 | 81 | ], |
| 81 | 82 | 'class' => 'common\components\urlManager\LangUrlManager', | ... | ... |
frontend/views/catalog/_product_item.php
| ... | ... | @@ -17,6 +17,16 @@ use yii\helpers\Url; |
| 17 | 17 | 'catalog/product', |
| 18 | 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 | 30 | <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [ |
| 21 | 31 | 'alt' => $model->category->name . ' ' . $model->fullname, |
| 22 | 32 | 'title' => $model->category->name . ' ' . $model->fullname, |
| ... | ... | @@ -37,6 +47,15 @@ use yii\helpers\Url; |
| 37 | 47 | </div> |
| 38 | 48 | </div> |
| 39 | 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 | 59 | <div class="dlexfduinxipi"> |
| 41 | 60 | Цена: |
| 42 | 61 | <span class="main"> | ... | ... |
frontend/views/catalog/product.php
| ... | ... | @@ -207,7 +207,7 @@ FlipclockAsset::register($this); |
| 207 | 207 | — Самовывоз Новая Почта - 55 грн.<br> |
| 208 | 208 | — Курьер Новая Почта - 88 грн.<br> |
| 209 | 209 | — Курьер «ИнТайм» - 60 грн.</p> |
| 210 | - <?php if($product->variant->price > 1000){?> | |
| 210 | + <?php if($product->variant->price >= 1000){?> | |
| 211 | 211 | <p> |
| 212 | 212 | <span class="strong black">Киев</span>:<br> |
| 213 | 213 | — Курьер - <s>50 грн.</s> | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -23,10 +23,9 @@ use common\models\Event; |
| 23 | 23 | |
| 24 | 24 | <meta charset="<?= Yii::$app->charset ?>"/> |
| 25 | 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 | 27 | <?= Seo::widget([ 'row'=>'description'])?> |
| 29 | - <?= Seo::widget([ 'row'=>'meta'])?> */?> | |
| 28 | + <?= Seo::widget([ 'row'=>'meta'])?> | |
| 30 | 29 | <link rel="icon" type="image/vnd.microsoft.icon" href="/images/icon.ico"/> |
| 31 | 30 | <link type="image/ico" href="http://www.linija-svitla.ua/images/icon.ico" rel="SHORTCUT ICON"/> |
| 32 | 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) : ?> </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> '; | |
| 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 | 0 | \ No newline at end of file |
frontend/views/search/index.php
| ... | ... | @@ -84,8 +84,9 @@ $this->params['breadcrumbs'][] = 'Поиск'; |
| 84 | 84 | <?= ListView::widget([ |
| 85 | 85 | 'dataProvider' => $productProvider, |
| 86 | 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 | 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 | 14544 | -ms-filter: grayscale(0%); |
| 14545 | 14545 | -o-filter: grayscale(0%); |
| 14546 | 14546 | -moz-filter: grayscale(0%); |
| 14547 | +} | |
| 14548 | + | |
| 14549 | +.banner-in-list{ | |
| 14550 | + margin: 0 !important; | |
| 14547 | 14551 | } |
| 14548 | 14552 | \ No newline at end of file | ... | ... |