Commit dc2cd0174e6eeb554bf77b9fe0b4dfd3f23dc064
1 parent
1772b984
-
Showing
32 changed files
with
432 additions
and
190 deletions
 
Show diff stats
backend/views/slider-image/_form.php
| ... | ... | @@ -23,7 +23,7 @@ use yii\widgets\ActiveForm; | 
| 23 | 23 | ], | 
| 24 | 24 | 'pluginOptions' => [ | 
| 25 | 25 | 'allowedFileExtensions' => ['jpg','gif','png'], | 
| 26 | - 'initialPreview' => $model->imageUrl ? Yii::$app->imageCache->thumb($model->imageUrl, 'slider') : '', | |
| 26 | + 'initialPreview' => $model->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'slider') : '', | |
| 27 | 27 | 'overwriteInitial' => true, | 
| 28 | 28 | 'showRemove' => true, | 
| 29 | 29 | 'showUpload' => false, | ... | ... | 
backend/web/css/site.css
common/config/main.php
| ... | ... | @@ -75,49 +75,46 @@ return [ | 
| 75 | 75 | 'height' => 300, | 
| 76 | 76 | 'master' => null | 
| 77 | 77 | ], | 
| 78 | - /*'flip' => [ | |
| 79 | - 'direction' => \common\components\artboximage\drivers\Image::HORIZONTAL | |
| 80 | - ]*/ | |
| 81 | 78 | ], | 
| 82 | - 'brandlist' => [ | |
| 79 | + 'product_variant' => [ | |
| 83 | 80 | 'resize' => [ | 
| 84 | - 'width' => 138, | |
| 85 | - 'height' => 78, | |
| 81 | + 'width' => 44, | |
| 82 | + 'height' => 44, | |
| 86 | 83 | 'master' => null | 
| 87 | 84 | ], | 
| 88 | 85 | ], | 
| 89 | - 'product_trumb' => [ | |
| 86 | + 'product_trumb2' => [ | |
| 90 | 87 | 'resize' => [ | 
| 91 | - 'width' => 80, | |
| 92 | - 'height' => 80, | |
| 88 | + 'width' => 100, | |
| 89 | + 'height' => 100, | |
| 93 | 90 | 'master' => null | 
| 94 | 91 | ], | 
| 95 | 92 | ], | 
| 96 | - 'product_variant' => [ | |
| 93 | + 'slider' => [ | |
| 97 | 94 | 'resize' => [ | 
| 98 | - 'width' => 44, | |
| 99 | - 'height' => 44, | |
| 95 | + 'width' => 720, | |
| 96 | + 'height' => 340, | |
| 100 | 97 | 'master' => null | 
| 101 | 98 | ], | 
| 102 | 99 | ], | 
| 103 | - 'product_list' => [ | |
| 100 | + 'brandlist' => [ | |
| 104 | 101 | 'resize' => [ | 
| 105 | - 'width' => 130, | |
| 106 | - 'height' => 70, | |
| 102 | + 'width' => 128, | |
| 103 | + 'height' => 128, | |
| 107 | 104 | 'master' => null | 
| 108 | 105 | ], | 
| 109 | 106 | ], | 
| 110 | - 'product_list2' => [ | |
| 107 | + 'mainmenu' => [ | |
| 111 | 108 | 'resize' => [ | 
| 112 | - 'width' => 130, | |
| 113 | - 'height' => 70, | |
| 109 | + 'width' => 160, | |
| 110 | + 'height' => 170, | |
| 114 | 111 | 'master' => null | 
| 115 | 112 | ], | 
| 116 | 113 | ], | 
| 117 | - 'mainmenu' => [ | |
| 114 | + 'list' => [ | |
| 118 | 115 | 'resize' => [ | 
| 119 | - 'width' => 160, | |
| 120 | - 'height' => 170, | |
| 116 | + 'width' => 134, | |
| 117 | + 'height' => 200, | |
| 121 | 118 | 'master' => null | 
| 122 | 119 | ], | 
| 123 | 120 | ], | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +class Share extends \yii\db\ActiveRecord | |
| 8 | +{ | |
| 9 | + | |
| 10 | + public static function tableName() | |
| 11 | + { | |
| 12 | + return 'share'; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public function attributeLabels() | |
| 16 | + { | |
| 17 | + return [ | |
| 18 | + 'product_name' => 'Название', | |
| 19 | + 'date_time'=>'Дата', | |
| 20 | + ]; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public function beforeSave($insert) { | |
| 24 | + $this->user_id = Yii::$app->user->id; | |
| 25 | + $this->date_time = time(); | |
| 26 | + $this->date = new \yii\db\Expression('NOW()'); | |
| 27 | + return parent::beforeSave($insert); | |
| 28 | + } | |
| 29 | + | |
| 30 | + public function beforeDelete() { | |
| 31 | + return parent::beforeDelete(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + public function getProduct() | |
| 35 | + { | |
| 36 | + return $this->hasOne(Products::className(), ['id' => 'product_id']); | |
| 37 | + } | |
| 38 | + | |
| 39 | + public function getShareList() | |
| 40 | + { | |
| 41 | + return $this->hasMany(self::className(), ['date' => 'date'])->where(['user_id'=>Yii::$app->user->id])->orderBy('id DESC'); | |
| 42 | + } | |
| 43 | + | |
| 44 | +} | ... | ... | 
common/modules/product/controllers/ManageController.php
| ... | ... | @@ -127,7 +127,7 @@ class ManageController extends Controller | 
| 127 | 127 | if ($model->load(Yii::$app->request->post())) { | 
| 128 | 128 | $model->imagesUpload = UploadedFile::getInstances($model, 'imagesUpload'); | 
| 129 | 129 | |
| 130 | - if ($model->save()) { | |
| 130 | + if ($model->save() && $model->imagesUpload) { | |
| 131 | 131 | foreach ($model->images as $image) { | 
| 132 | 132 | $image->delete(); | 
| 133 | 133 | } | 
| ... | ... | @@ -214,6 +214,36 @@ class ManageController extends Controller | 
| 214 | 214 | exit; | 
| 215 | 215 | } | 
| 216 | 216 | |
| 217 | + public function actionIs_top($id) { | |
| 218 | + $model = $this->findModel($id); | |
| 219 | + | |
| 220 | + $model->is_top = intval(empty($model->is_top)); | |
| 221 | + | |
| 222 | + $model->save(false, ['is_top']); | |
| 223 | + | |
| 224 | + return $this->redirect(['index']); | |
| 225 | + } | |
| 226 | + | |
| 227 | + public function actionIs_new($id) { | |
| 228 | + $model = $this->findModel($id); | |
| 229 | + | |
| 230 | + $model->is_new = intval(empty($model->is_new)); | |
| 231 | + | |
| 232 | + $model->save(false, ['is_new']); | |
| 233 | + | |
| 234 | + return $this->redirect(['index']); | |
| 235 | + } | |
| 236 | + | |
| 237 | + public function actionAkciya($id) { | |
| 238 | + $model = $this->findModel($id); | |
| 239 | + | |
| 240 | + $model->akciya = intval(empty($model->akciya)); | |
| 241 | + | |
| 242 | + $model->save(false, ['akciya']); | |
| 243 | + | |
| 244 | + return $this->redirect(['index']); | |
| 245 | + } | |
| 246 | + | |
| 217 | 247 | public function actionImport() { | 
| 218 | 248 | $searchModel = new RemoteProductsSearch(); | 
| 219 | 249 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ... | ... | 
common/modules/product/helpers/ProductHelper.php
| ... | ... | @@ -69,8 +69,23 @@ class ProductHelper extends Object { | 
| 69 | 69 | public static function getLastProducts($as_object = false) { | 
| 70 | 70 | $last_products = Yii::$app->session->get('last_products', []); | 
| 71 | 71 | if ($as_object) { | 
| 72 | - $last_products = Product::find()->where(['product_id' => $last_products])->all(); | |
| 72 | + $last_products = array_reverse(Product::find()->where(['product_id' => $last_products])->all()); | |
| 73 | 73 | } | 
| 74 | 74 | return $last_products; | 
| 75 | 75 | } | 
| 76 | + | |
| 77 | + public static function getSpecialProducts($type, $count, $sort = null) { | |
| 78 | + switch($type) { | |
| 79 | + case 'top': | |
| 80 | + $data = ['is_top' => true]; | |
| 81 | + break; | |
| 82 | + case 'new': | |
| 83 | + $data = ['is_new' => true]; | |
| 84 | + break; | |
| 85 | + case 'promo': | |
| 86 | + $data = ['akciya' => true]; | |
| 87 | + break; | |
| 88 | + } | |
| 89 | + return Product::find()->where($data)->limit($count)/*->orderBy($sort)*/->all(); | |
| 90 | + } | |
| 76 | 91 | } | 
| 77 | 92 | \ No newline at end of file | ... | ... | 
common/modules/product/models/Product.php
| ... | ... | @@ -24,6 +24,7 @@ use yii\web\UploadedFile; | 
| 24 | 24 | * @property array $images | 
| 25 | 25 | * @property boolean $is_top | 
| 26 | 26 | * @property boolean $is_new | 
| 27 | + * @property boolean $akciya | |
| 27 | 28 | */ | 
| 28 | 29 | class Product extends \yii\db\ActiveRecord | 
| 29 | 30 | { | 
| ... | ... | @@ -72,9 +73,9 @@ class Product extends \yii\db\ActiveRecord | 
| 72 | 73 | [['name'], 'string', 'max' => 150], | 
| 73 | 74 | [['alias'], 'string', 'max' => 250], | 
| 74 | 75 | [['categories', 'variants', 'options', 'imagesUpload'], 'safe'], | 
| 75 | - [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50], | |
| 76 | +// [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50], | |
| 76 | 77 | [['description', 'video'], 'safe'], | 
| 77 | - [['is_top', 'is_new'], 'boolean'], | |
| 78 | + [['is_top', 'is_new', 'akciya'], 'boolean'], | |
| 78 | 79 | // [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']], | 
| 79 | 80 | ]; | 
| 80 | 81 | } | 
| ... | ... | @@ -97,6 +98,7 @@ class Product extends \yii\db\ActiveRecord | 
| 97 | 98 | 'variants' => Yii::t('product', 'Variants'), | 
| 98 | 99 | 'is_top' => Yii::t('product', 'Is top'), | 
| 99 | 100 | 'is_new' => Yii::t('product', 'Is new'), | 
| 101 | + 'akciya' => Yii::t('product', 'Is promo'), | |
| 100 | 102 | ]; | 
| 101 | 103 | } | 
| 102 | 104 | |
| ... | ... | @@ -117,6 +119,16 @@ class Product extends \yii\db\ActiveRecord | 
| 117 | 119 | } | 
| 118 | 120 | |
| 119 | 121 | /** | 
| 122 | + * fetch stored image url | |
| 123 | + * @return string | |
| 124 | + */ | |
| 125 | + public function getImageUrl() | |
| 126 | + { | |
| 127 | + // return a default image placeholder if your source image is not found | |
| 128 | + return !empty($this->image) ? $this->image->imageUrl : '/images/no_photo.png'; | |
| 129 | + } | |
| 130 | + | |
| 131 | + /** | |
| 120 | 132 | * @return \yii\db\ActiveQuery | 
| 121 | 133 | */ | 
| 122 | 134 | public function getImages() | 
| ... | ... | @@ -200,7 +212,7 @@ class Product extends \yii\db\ActiveRecord | 
| 200 | 212 | // | 
| 201 | 213 | // } | 
| 202 | 214 | |
| 203 | - $todel = []; | |
| 215 | + /*$todel = []; | |
| 204 | 216 | foreach ($this->variants ? : [] as $_variant) { | 
| 205 | 217 | $todel[$_variant->product_variant_id] = $_variant->product_variant_id; | 
| 206 | 218 | } | 
| ... | ... | @@ -220,7 +232,7 @@ class Product extends \yii\db\ActiveRecord | 
| 220 | 232 | } | 
| 221 | 233 | if (!empty($todel)) { | 
| 222 | 234 | ProductVariant::deleteAll(['product_variant_id' => $todel]); | 
| 223 | - } | |
| 235 | + }*/ | |
| 224 | 236 | } | 
| 225 | 237 | |
| 226 | 238 | public function imagesUpload() | ... | ... | 
common/modules/product/models/ProductImage.php
| ... | ... | @@ -107,7 +107,7 @@ class ProductImage extends \yii\db\ActiveRecord | 
| 107 | 107 | public function getImageUrl() | 
| 108 | 108 | { | 
| 109 | 109 | // return a default image placeholder if your source image is not found | 
| 110 | - return isset($this->image) ? '/images/products/'. $this->image : 'default.jpg'; | |
| 110 | + return isset($this->image) ? '/images/products/'. $this->image : '/images/no_photo.png'; | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | ... | ... | 
common/modules/product/models/ProductSearch.php
| ... | ... | @@ -72,18 +72,32 @@ class ProductSearch extends Product | 
| 72 | 72 | |
| 73 | 73 | $query->joinWith(['brand', 'brand.brandNames', 'categories', 'categories.categoryNames']); | 
| 74 | 74 | |
| 75 | - // grid filtering conditions | |
| 75 | + if (isset($this->is_top)) { | |
| 76 | + $query->andFilterWhere([ | |
| 77 | + 'is_top' => (bool)$this->is_top, | |
| 78 | + ]); | |
| 79 | + } | |
| 80 | + if (isset($this->is_new)) { | |
| 81 | + $query->andFilterWhere([ | |
| 82 | + 'is_new' => (bool)$this->is_new, | |
| 83 | + ]); | |
| 84 | + } | |
| 85 | + if (isset($this->akciya)) { | |
| 86 | + $query->andFilterWhere([ | |
| 87 | + 'akciya' => (bool)$this->akciya, | |
| 88 | + ]); | |
| 89 | + } | |
| 76 | 90 | $query->andFilterWhere([ | 
| 77 | 91 | 'tax_brand_id' => $this->tax_brand_id, | 
| 78 | 92 | 'product_id' => $this->product_id, | 
| 79 | - 'is_top' => (bool)$this->is_top, | |
| 80 | - 'is_new' => (bool)$this->is_new, | |
| 81 | 93 | ]); | 
| 82 | 94 | |
| 83 | 95 | $query->andFilterWhere(['ilike', 'name', $this->name]); | 
| 84 | 96 | $query->andFilterWhere(['ilike', 'brand_name.value', $this->brand_name]); | 
| 85 | 97 | $query->andFilterWhere(['ilike', 'category_name.value', $this->category_name]); | 
| 86 | 98 | |
| 99 | + $query->orderBy('product.product_id', 'DESC'); | |
| 100 | + | |
| 87 | 101 | return $dataProvider; | 
| 88 | 102 | } | 
| 89 | 103 | ... | ... | 
common/modules/product/models/ProductVariant.php
| ... | ... | @@ -123,6 +123,16 @@ class ProductVariant extends \yii\db\ActiveRecord | 
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | 125 | /** | 
| 126 | + * fetch stored image url | |
| 127 | + * @return string | |
| 128 | + */ | |
| 129 | + public function getImageUrl() | |
| 130 | + { | |
| 131 | + // return a default image placeholder if your source image is not found | |
| 132 | + return !empty($this->image) ? $this->image->imageUrl : '/images/no_photo.png'; | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 126 | 136 | * @return \yii\db\ActiveQuery | 
| 127 | 137 | */ | 
| 128 | 138 | public function getImages() | ... | ... | 
common/modules/product/views/manage/_form.php
| ... | ... | @@ -23,6 +23,9 @@ use kartik\select2\Select2; | 
| 23 | 23 | |
| 24 | 24 | <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | 
| 25 | 25 | |
| 26 | + <?= $form->field($model, 'is_top')->checkbox() ?> | |
| 27 | + <?= $form->field($model, 'is_new')->checkbox() ?> | |
| 28 | + | |
| 26 | 29 | <?= $form->field($model, 'description')->widget(\mihaildev\ckeditor\CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?> | 
| 27 | 30 | <?= $form->field($model, 'video')->textarea(); ?> | 
| 28 | 31 | ... | ... | 
common/modules/product/views/manage/index.php
| ... | ... | @@ -40,7 +40,7 @@ $this->params['breadcrumbs'][] = $this->title; | 
| 40 | 40 | |
| 41 | 41 | [ | 
| 42 | 42 | 'class' => 'yii\grid\ActionColumn', | 
| 43 | - 'template' => '{view} {is_top} {is_new} {update} {delete}', | |
| 43 | + 'template' => '{view} |{is_top} {is_new} {akciya} | {update} {delete}', | |
| 44 | 44 | 'buttons' => [ | 
| 45 | 45 | 'is_top' => function ($url, $model) { | 
| 46 | 46 | return Html::a('<span class="glyphicon glyphicon-star' . ($model->is_top ? '' : '-empty') . '"></span>', $url, [ | 
| ... | ... | @@ -52,6 +52,11 @@ $this->params['breadcrumbs'][] = $this->title; | 
| 52 | 52 | 'title' => Yii::t('product', ($model->is_new ? 'Set not is new' : 'Set is new')), | 
| 53 | 53 | ]); | 
| 54 | 54 | }, | 
| 55 | + 'akciya' => function ($url, $model) { | |
| 56 | + return Html::a('<span class="glyphicon glyphicon-tag' . ($model->akciya ? 's' : '') . '"></span>', $url, [ | |
| 57 | + 'title' => Yii::t('product', ($model->akciya ? 'Set not is promotion' : 'Set is promotion')), | |
| 58 | + ]); | |
| 59 | + }, | |
| 55 | 60 | ], | 
| 56 | 61 | 'urlCreator' => function ($action, $model, $key, $index) { | 
| 57 | 62 | switch ($action) { | 
| ... | ... | @@ -61,6 +66,9 @@ $this->params['breadcrumbs'][] = $this->title; | 
| 61 | 66 | case 'is_new': | 
| 62 | 67 | return \yii\helpers\Url::to(['manage/is_new', 'id' => $model->product_id]); | 
| 63 | 68 | break; | 
| 69 | + case 'akciya': | |
| 70 | + return \yii\helpers\Url::to(['manage/akciya', 'id' => $model->product_id]); | |
| 71 | + break; | |
| 64 | 72 | case 'view': | 
| 65 | 73 | return \yii\helpers\Url::to(['/catalog/product', 'id' => $model->product_id, ['target' => '_blank']]); | 
| 66 | 74 | break; | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\modules\product\widgets; | |
| 4 | + | |
| 5 | +use common\modules\product\helpers\ProductHelper; | |
| 6 | +use common\modules\product\models\Category; | |
| 7 | +use yii\base\Widget; | |
| 8 | + | |
| 9 | +class lastProducts extends Widget { | |
| 10 | + public function init() | |
| 11 | + { | |
| 12 | + parent::init(); // TODO: Change the autogenerated stub | |
| 13 | + } | |
| 14 | + | |
| 15 | + public function run() { | |
| 16 | + return $this->render('products_block', [ | |
| 17 | + 'title' => \Yii::t('product', 'Вы недавно просматривали'), | |
| 18 | + 'products' => ProductHelper::getLastProducts(true), | |
| 19 | + ]); | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\modules\product\widgets; | |
| 4 | + | |
| 5 | +use common\modules\product\helpers\ProductHelper; | |
| 6 | +use common\modules\product\models\Category; | |
| 7 | +use yii\base\Widget; | |
| 8 | +use Yii; | |
| 9 | + | |
| 10 | +class specialProducts extends Widget { | |
| 11 | + public $type = 'top'; | |
| 12 | + | |
| 13 | + public $count = 4; | |
| 14 | + | |
| 15 | + public $sort = 'default'; | |
| 16 | + | |
| 17 | + public $title; | |
| 18 | + | |
| 19 | + public function init() | |
| 20 | + { | |
| 21 | + parent::init(); // TODO: Change the autogenerated stub | |
| 22 | + } | |
| 23 | + | |
| 24 | + public function run() { | |
| 25 | + $products = ProductHelper::getSpecialProducts($this->type, $this->count, $this->sort); | |
| 26 | + | |
| 27 | + if (!$this->title) { | |
| 28 | + switch($this->type) { | |
| 29 | + case 'top': | |
| 30 | + $this->title = Yii::t('product', 'Top products'); | |
| 31 | + break; | |
| 32 | + case 'promo': | |
| 33 | + $this->title = Yii::t('product', 'Promo products'); | |
| 34 | + break; | |
| 35 | + case 'new': | |
| 36 | + $this->title = Yii::t('product', 'New products'); | |
| 37 | + break; | |
| 38 | + } | |
| 39 | + } | |
| 40 | + | |
| 41 | + return $this->render('products_block', [ | |
| 42 | + 'title' => $this->title, | |
| 43 | + 'products' => $products, | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | +} | |
| 0 | 47 | \ No newline at end of file | ... | ... | 
common/modules/product/widgets/views/brandsCarousel.php
| ... | ... | @@ -3,7 +3,7 @@ | 
| 3 | 3 | <div class="prods_carousel"> | 
| 4 | 4 | <ul> | 
| 5 | 5 | <?php foreach($brands as $brand) :?> | 
| 6 | - <li><span><a href="<?= \yii\helpers\Url::to('/brands/'. $brand->alias)?>" title="<?= $brand->name?>"><?= $brand->imageFile ? Yii::$app->imageCache->thumb($brand->imageFile, 'brandlist') : ''?></a></span></li> | |
| 6 | + <li><span><a href="<?= \yii\helpers\Url::to('/brands/'. $brand->alias)?>" title="<?= $brand->name?>"><?= $brand->imageFile ? \common\components\artboximage\ArtboxImageHelper::getImage($brand->imageFile, 'brandlist') : ''?></a></span></li> | |
| 7 | 7 | <?php endforeach?> | 
| 8 | 8 | </ul> | 
| 9 | 9 | </div> | ... | ... | 
common/modules/product/widgets/views/product_smart.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** @var \common\modules\product\models\Product $product */ | |
| 3 | +use yii\helpers\Url; | |
| 4 | +?> | |
| 5 | +<li class="item"> | |
| 6 | + <div class="boxitem"> | |
| 7 | + <div class="pixbox"> | |
| 8 | + <a href="<?= Url::to([ | |
| 9 | + 'catalog/product', | |
| 10 | + 'product' => $product]) | |
| 11 | + ?>"> | |
| 12 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'list')?> | |
| 13 | + </a> | |
| 14 | + </div> | |
| 15 | + <a href="<?= Url::to([ | |
| 16 | + 'catalog/product', | |
| 17 | + 'product' => $product]) | |
| 18 | + ?>" class="name"><?= $product->name ?> | |
| 19 | + </a> | |
| 20 | + | |
| 21 | + <?php | |
| 22 | + | |
| 23 | + echo '<div class="cost-block">'; | |
| 24 | + | |
| 25 | + // есть скидка | |
| 26 | + if ($product->variant->price_old != 0 && $product->variant->price_old != $product->variant->price) | |
| 27 | + { | |
| 28 | + echo '<strike><span id=\'old_cost\'>'.$product->variant->price_old.'</span> грн.</strike>'; | |
| 29 | + } | |
| 30 | + | |
| 31 | + echo '<p class="cost">'.$product->variant->price.' грн.</p>'; | |
| 32 | + | |
| 33 | + echo '</div>'; | |
| 34 | + | |
| 35 | + ?> | |
| 36 | + </div> | |
| 37 | + <a href="<?= Url::to([ | |
| 38 | + 'catalog/product', | |
| 39 | + 'product' => $product]) | |
| 40 | + ?>" class="link_buy">Купить</a> | |
| 41 | + | |
| 42 | + <div class="mycarousel"> | |
| 43 | + <ul class="jcarousel jcarousel-skin-tango"> | |
| 44 | + <?php foreach ($product->variants as $variant) : ?> | |
| 45 | + <li> | |
| 46 | + <a href="<?= Url::to([ | |
| 47 | + 'catalog/product', | |
| 48 | + 'product' => $product, | |
| 49 | + '#' => 'm' . $variant->product_variant_id]) ?>"> | |
| 50 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | |
| 51 | + </a> | |
| 52 | + </li> | |
| 53 | + <?php endforeach; ?> | |
| 54 | + </ul> | |
| 55 | + </div> | |
| 56 | +</li> | |
| 0 | 57 | \ No newline at end of file | ... | ... | 
common/modules/product/widgets/views/products_block.php
0 → 100644
common/modules/product/widgets/views/submenu.php
| ... | ... | @@ -12,7 +12,7 @@ | 
| 12 | 12 | <?php if (empty($_item->image)) :?> | 
| 13 | 13 | <img valign="top" src="/images/no_photo.png"> | 
| 14 | 14 | <?php else :?> | 
| 15 | - <?= $_item->imageUrl ? Yii::$app->imageCache->thumb($_item->imageUrl, 'mainmenu') : ''?> | |
| 15 | + <?= $_item->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item->imageUrl, 'mainmenu') : ''?> | |
| 16 | 16 | <?php endif?> | 
| 17 | 17 | </div> | 
| 18 | 18 | <div class="title"><?= $_item->categoryName->value?></div> | 
| ... | ... | @@ -34,7 +34,7 @@ | 
| 34 | 34 | <?php if (empty($_item['item']->image)) :?> | 
| 35 | 35 | <img valign="top" src="/images/no_photo.png"> | 
| 36 | 36 | <?php else :?> | 
| 37 | - <?= $_item['item']->imageUrl ? Yii::$app->imageCache->thumb($_item['item']->imageUrl, 'mainmenu') : ''?> | |
| 37 | + <?= $_item['item']->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item['item']->imageUrl, 'mainmenu') : ''?> | |
| 38 | 38 | <?php endif?> | 
| 39 | 39 | </div> | 
| 40 | 40 | <div class="title"><?= $_item['item']->categoryName->value?></div> | ... | ... | 
frontend/config/main.php
| ... | ... | @@ -38,7 +38,7 @@ return [ | 
| 38 | 38 | 'errorHandler' => [ | 
| 39 | 39 | 'errorAction' => 'site/error', | 
| 40 | 40 | ], | 
| 41 | - 'imageCache' => [ | |
| 41 | + /*'imageCache' => [ | |
| 42 | 42 | 'class' => 'iutbay\yii2imagecache\ImageCache', | 
| 43 | 43 | 'sourcePath' => '@app/web/images', | 
| 44 | 44 | 'sourceUrl' => '@web/images', | 
| ... | ... | @@ -56,7 +56,7 @@ return [ | 
| 56 | 56 | 'mainmenu' => [160, 170], | 
| 57 | 57 | 'large' => [600, 600], | 
| 58 | 58 | ], | 
| 59 | - ], | |
| 59 | + ],*/ | |
| 60 | 60 | 'urlManager' => [ | 
| 61 | 61 | 'enablePrettyUrl' => true, | 
| 62 | 62 | 'showScriptName' => false, | ... | ... | 
frontend/controllers/CatalogController.php
| ... | ... | @@ -42,8 +42,6 @@ class CatalogController extends \yii\web\Controller | 
| 42 | 42 | throw new HttpException(404 ,'Page not found'); | 
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | - $last_products = ProductHelper::getLastProducts(true); | |
| 46 | - | |
| 47 | 45 | if (!empty($word)) { | 
| 48 | 46 | $params = []; | 
| 49 | 47 | |
| ... | ... | @@ -73,7 +71,6 @@ class CatalogController extends \yii\web\Controller | 
| 73 | 71 | 'category' => $category, | 
| 74 | 72 | 'productModel' => $productModel, | 
| 75 | 73 | 'productProvider' => $productProvider, | 
| 76 | - 'last_products' => $last_products, | |
| 77 | 74 | 'categories' => $categories, | 
| 78 | 75 | ] | 
| 79 | 76 | ); | 
| ... | ... | @@ -145,7 +142,6 @@ class CatalogController extends \yii\web\Controller | 
| 145 | 142 | 'optionsProvider' => $optionsProvider, | 
| 146 | 143 | 'groups' => $groups, | 
| 147 | 144 | 'priceLimits' => $priceLimits, | 
| 148 | - 'last_products' => $last_products, | |
| 149 | 145 | ] | 
| 150 | 146 | ); | 
| 151 | 147 | } | 
| ... | ... | @@ -169,14 +165,12 @@ class CatalogController extends \yii\web\Controller | 
| 169 | 165 | } | 
| 170 | 166 | $category = $product->category; | 
| 171 | 167 | |
| 172 | - $last_products = ProductHelper::getLastProducts(true); | |
| 173 | 168 | ProductHelper::addLastProsucts($product->product_id); | 
| 174 | 169 | |
| 175 | 170 | return $this->render('product', [ | 
| 176 | 171 | 'product' => $product, | 
| 177 | 172 | 'category' => $category, | 
| 178 | 173 | 'properties' => $groups, | 
| 179 | - 'last_products' => $last_products | |
| 180 | 174 | ]); | 
| 181 | 175 | } | 
| 182 | 176 | ... | ... | 
frontend/models/ProductFrontendSearch.php
| ... | ... | @@ -55,7 +55,9 @@ class ProductFrontendSearch extends Product { | 
| 55 | 55 | $query->joinWith('brand'); | 
| 56 | 56 | $query->joinWith('image'); | 
| 57 | 57 | $query->joinWith('categories'); | 
| 58 | - $query->groupBy('product.product_id'); | |
| 58 | + if (empty($_GET['sort']) || ($_GET['sort'] != 'price' && $_GET['sort'] != '-price')) { | |
| 59 | + $query->groupBy('product.product_id'); | |
| 60 | + } | |
| 59 | 61 | |
| 60 | 62 | $dataProvider = new ActiveDataProvider([ | 
| 61 | 63 | 'query' => $query, | ... | ... | 
frontend/views/catalog/product.php
| ... | ... | @@ -102,10 +102,11 @@ $this->registerJs (" | 
| 102 | 102 | data-cost="<?= $variant->price ?>" | 
| 103 | 103 | data-old_cost="<?= $variant->price_old ?>" data-id="<?= $variant->product_variant_id ?>" data-art="<?= $variant->sku ?>" | 
| 104 | 104 | data-color="<?= $variant->name ?>" | 
| 105 | - data-image="<?= $variant->image->imageUrl ?>" | |
| 106 | - data-imageoriginal="<?= $variant->image->imageUrl ?>" | |
| 105 | + data-image="<?= $variant->imageUrl ?>" | |
| 106 | + data-imageoriginal="<?= $variant->imageUrl ?>" | |
| 107 | 107 | title="<?= $product->name ?>"> | 
| 108 | - <?= Yii::$app->imageCache->thumb($variant->image->imageUrl, 'product_variant')?> | |
| 108 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | |
| 109 | + | |
| 109 | 110 | </a> | 
| 110 | 111 | </li> | 
| 111 | 112 | <?php endforeach; ?> | 
| ... | ... | @@ -157,13 +158,13 @@ $this->registerJs (" | 
| 157 | 158 | <div class="content"> | 
| 158 | 159 | <div class="pic"> | 
| 159 | 160 | <center> | 
| 160 | - <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= Yii::$app->imageCache->thumb($product->image->imageUrl, 'product')?></a> | |
| 161 | + <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'product')?></a> | |
| 161 | 162 | </center> | 
| 162 | 163 | </div> | 
| 163 | 164 | <ul class="product_colors"> | 
| 164 | 165 | <?php foreach ($product->images as $image): ?> | 
| 165 | 166 | <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]"> | 
| 166 | - <?= Yii::$app->imageCache->thumb($image->imageUrl, 'product_trumb2')?> | |
| 167 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2')?> | |
| 167 | 168 | </a></li> | 
| 168 | 169 | <?php endforeach; ?> | 
| 169 | 170 | </ul> | ... | ... | 
frontend/views/catalog/product_item.php
| ... | ... | @@ -12,7 +12,7 @@ use yii\helpers\Url; | 
| 12 | 12 | <?php if (empty($product->image)) :?> | 
| 13 | 13 | <img src="/img/no_photo.png"> | 
| 14 | 14 | <?php else :?> | 
| 15 | - <?= Yii::$app->imageCache->thumb($product->image->imageUrl, 'list')?> | |
| 15 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->image->imageUrl, 'list')?> | |
| 16 | 16 | <?php endif?> | 
| 17 | 17 | </a> | 
| 18 | 18 | </div> | 
| ... | ... | @@ -52,7 +52,7 @@ use yii\helpers\Url; | 
| 52 | 52 | 'catalog/product', | 
| 53 | 53 | 'product' => $product, | 
| 54 | 54 | '#' => 'm' . $variant->product_variant_id]) ?>"> | 
| 55 | - <?= Yii::$app->imageCache->thumb($variant->image->imageUrl, 'product_variant')?> | |
| 55 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->image->imageUrl, 'product_variant')?> | |
| 56 | 56 | </a> | 
| 57 | 57 | </li> | 
| 58 | 58 | <?php endif; ?> | ... | ... | 
frontend/views/catalog/product_smart.php deleted
| 1 | -<?php | |
| 2 | -/** @var \common\modules\product\models\Product $product */ | |
| 3 | - | |
| 4 | -?> | |
| 5 | -<div class="my_custom_card"> | |
| 6 | - <!--<div class="new">АКЦИЯ</div> | |
| 7 | - <div class="top">Toп</div>--> | |
| 8 | - <a href="<?= \yii\helpers\Url::to(['catalog/product', 'product' => $product])?>" class="item_link"><div class="pic"><img src="/images/no_photo.png"></div> | |
| 9 | - <div class="title_item"><?= $product->name?></div></a> | |
| 10 | - <?php if ($product->brand) :?> | |
| 11 | - <div class="brand">Бренд: <span><?= $product->brand->name?></span></div> | |
| 12 | - <?php endif?> | |
| 13 | - <div class="type"><?= implode(', ', $product->categoriesNames)?></div> | |
| 14 | - <?php if($product->variant) :?> | |
| 15 | - <div class="price"><?= $product->variant->price?> <span>грн.</span></div> | |
| 16 | - <button class="basket_add_but" data-id="<?= $product->variant->product_variant_id?>">в корзину</button> | |
| 17 | - <?php endif?> | |
| 18 | - <a href="#" class="compare_add_but" data-id="<?= $product->product_id?>"><span>добавить к сравнению</span></a> | |
| 19 | - <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> | |
| 20 | -</div> | |
| 21 | 0 | \ No newline at end of file | 
frontend/views/catalog/products.php
| ... | ... | @@ -128,6 +128,20 @@ $this->registerJsFile (Yii::getAlias('@web/js/ion.rangeSlider.js')); | 
| 128 | 128 | |
| 129 | 129 | <div class="content"> | 
| 130 | 130 | <h1><?= $category->name ?></h1> | 
| 131 | + <div class="sort_menu"> | |
| 132 | + | |
| 133 | + <div class="sort_block"> | |
| 134 | + <span>Сортировка:</span> | |
| 135 | + <?= \yii\widgets\LinkSorter::widget([ | |
| 136 | + 'sort' => $productProvider->sort, | |
| 137 | + 'attributes' => [ | |
| 138 | + 'name', | |
| 139 | + 'price', | |
| 140 | + ] | |
| 141 | + ]); | |
| 142 | + ?> | |
| 143 | + </div> | |
| 144 | + </div> | |
| 131 | 145 | <div class="products pn"> | 
| 132 | 146 | <ul> | 
| 133 | 147 | <?php foreach($productProvider->models as $product) :?> | 
| ... | ... | @@ -148,15 +162,5 @@ $this->registerJsFile (Yii::getAlias('@web/js/ion.rangeSlider.js')); | 
| 148 | 162 | </div> | 
| 149 | 163 | <div class="both"></div> | 
| 150 | 164 | |
| 151 | - <?php if(!empty($last_products)) :?> | |
| 152 | - <hr> | |
| 153 | - <div class="watched_block"> | |
| 154 | - <h1>Вы недавно просматривали</h1> | |
| 155 | - <div class="flex-container"> | |
| 156 | - <?php foreach($last_products as $product) :?> | |
| 157 | - <?php require(__DIR__ .'/product_smart.php')?> | |
| 158 | - <?php endforeach?> | |
| 159 | - </div> | |
| 160 | - </div> | |
| 161 | - <?php endif?> | |
| 165 | + <?= \common\modules\product\widgets\lastProducts::widget()?> | |
| 162 | 166 | </div> | 
| 163 | 167 | \ No newline at end of file | ... | ... | 
frontend/views/catalog/search.php
| ... | ... | @@ -122,15 +122,5 @@ $this->params['seo']['key']= 'product_list'; | 
| 122 | 122 | <?php endif?> | 
| 123 | 123 | </div> | 
| 124 | 124 | |
| 125 | - <?php if(!empty($last_products)) :?> | |
| 126 | - <hr> | |
| 127 | - <div class="watched_block"> | |
| 128 | - <h1>Вы недавно просматривали</h1> | |
| 129 | - <div class="flex-container"> | |
| 130 | - <?php foreach($last_products as $product) :?> | |
| 131 | - <?php require(__DIR__ .'/product_smart.php')?> | |
| 132 | - <?php endforeach?> | |
| 133 | - </div> | |
| 134 | - </div> | |
| 135 | - <?php endif?> | |
| 125 | + <?= \common\modules\product\widgets\lastProducts::widget()?> | |
| 136 | 126 | </div> | 
| 137 | 127 | \ No newline at end of file | ... | ... | 
frontend/views/layouts/main-menu.php
| 1 | 1 | <?php | 
| 2 | 2 | use common\modules\product\models\Category; | 
| 3 | 3 | use yii\helpers\Url; | 
| 4 | -use yii\widgets\Menu; | |
| 5 | - | |
| 6 | - | |
| 7 | -foreach (Category::find ()->all () as $category){ | |
| 8 | - $categoryObject = Yii::$app->request->get('category'); | |
| 9 | - $menu[] = ['label' => $category->name , | |
| 10 | - 'url' => Url::to(['catalog/category', 'category' => $category]), | |
| 11 | - 'active' => isset($categoryObject) && $categoryObject->alias == $category->alias ? true : false ]; | |
| 12 | -} | |
| 13 | - | |
| 14 | -$main_menu = Menu::widget([ | |
| 15 | - 'items' => $menu, | |
| 16 | -]); | |
| 17 | 4 | ?> | 
| 18 | 5 | |
| 19 | -<?=$main_menu?> | |
| 6 | +<?= \frontend\widgets\Rubrics::widget([])?> | |
| 20 | 7 | <div class="fr"> | 
| 21 | 8 | <ul> | 
| 22 | 9 | <li class="akciya"><a href="<?= Url::to (['event/index',]) ?>">Акции</a></li> | ... | ... | 
frontend/views/site/index.php
| ... | ... | @@ -29,47 +29,12 @@ echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_3']); | 
| 29 | 29 | echo '</div>'; | 
| 30 | 30 | ?> | 
| 31 | 31 | |
| 32 | -<div class="rubrics"> | |
| 33 | - <ul> | |
| 34 | - <li class="item1"><a href="<?= Url::to (['products/index', 'translit' => 'ryukzaki']) ?>">Рюкзаки</a></li> | |
| 35 | - <li class="item2"><a href="<?= Url::to (['products/index', 'translit' => 'sumki']) ?>">сумки</a></li> | |
| 36 | - <li class="item3"><a href="<?= Url::to (['products/index', 'translit' => 'chehly']) ?>">чехлы</a></li> | |
| 37 | - <li class="item4"><a href="<?= Url::to (['products/index', 'translit' => 'nesessery']) ?>">Несессеры</a></li> | |
| 38 | - <li class="item5"><a href="<?= Url::to (['products/index', 'translit' => 'koshelki']) ?>">кошельки</a></li> | |
| 39 | - </ul> | |
| 40 | - <div class="both"></div> | |
| 41 | -</div> | |
| 32 | +<?= \frontend\widgets\Rubrics::widget(['wrapper' => 'rubrics'])?> | |
| 42 | 33 | |
| 43 | -<?php //TODO вставляем топ товары?> | |
| 44 | -<?// if (count ($products_top) > 0): ?> | |
| 45 | -<!-- <div class="products">--> | |
| 46 | -<!-- <h3>Топ товары</h3>--> | |
| 47 | -<!-- <ul>--> | |
| 48 | -<!----> | |
| 49 | -<!-- --><?// foreach ($products_top as $item): ?> | |
| 50 | -<!-- <li class="item">--> | |
| 51 | -<!-- --><?//= $this->render ('/products/_product', ['item' => $item, 'num' => 4]) ?> | |
| 52 | -<!-- </li>--> | |
| 53 | -<!-- --><?// endforeach; ?> | |
| 54 | -<!----> | |
| 55 | -<!-- </ul>--> | |
| 56 | -<!-- <div class="both"></div>--> | |
| 57 | -<!-- </div>--> | |
| 58 | -<?// endif; ?> | |
| 59 | - | |
| 60 | - | |
| 61 | -<div class="products"> | |
| 62 | - <h3>Скидки</h3> | |
| 63 | - <ul> | |
| 64 | - <?php //TODO вставляем новинки?> | |
| 65 | - <!-- --><?// foreach ($products_new as $item): ?> | |
| 66 | - <!-- <li class="item">--> | |
| 67 | - <!-- --><?//= $this->render ('/products/_product', ['item' => $item, 'num' => 4]) ?> | |
| 68 | - <!-- </li>--> | |
| 69 | - <!-- --><?// endforeach; ?> | |
| 70 | - </ul> | |
| 71 | - <div class="both"></div> | |
| 72 | -</div> | |
| 34 | +<?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?> | |
| 35 | +<?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?> | |
| 36 | +<?= \common\modules\product\widgets\specialProducts::widget(['type' => 'top'])?> | |
| 37 | +<?= \common\modules\product\widgets\lastProducts::widget()?> | |
| 73 | 38 | |
| 74 | 39 | |
| 75 | 40 | <h2 class="why"><span>Почему</span></h2> | ... | ... | 
frontend/web/css/style.css
| 1 | 1 | html,form, | 
| 2 | -body { padding:0;margin:0; | |
| 2 | +body { padding:0px;margin:0px; | |
| 3 | 3 | font-family: 'Roboto';font-size:14px;color:#1d1d1b;height:100%; | 
| 4 | 4 | } | 
| 5 | 5 | h1,h2,h3{margin:0px;padding:0px 0px 10px 0px;} | 
| ... | ... | @@ -8,7 +8,7 @@ h1,h2,h3{margin:0px;padding:0px 0px 10px 0px;} | 
| 8 | 8 | .fotter .wrap .fr img{position: absolute; top: 50%; margin-top: -10px; right: 0;} | 
| 9 | 9 | .fotter .wrap .fl {line-height: 50px;} | 
| 10 | 10 | .both{clear:both;} | 
| 11 | -h1{margin:10px 0;font-size:24px;} | |
| 11 | +h1{margin:10px 0px;font-size:24px;} | |
| 12 | 12 | h3{margin-bottom:30px;} | 
| 13 | 13 | p{margin:3px 0px;padding:0px;} | 
| 14 | 14 | |
| ... | ... | @@ -21,9 +21,9 @@ a:hover{color:#799920;} | 
| 21 | 21 | .f{background: #ffffff;} | 
| 22 | 22 | |
| 23 | 23 | .br{-webkit-box-shadow: -1px 5px 14px 0px rgba(50, 46, 50, 0.46); | 
| 24 | - -moz-box-shadow: -1px 5px 14px 0px rgba(50, 46, 50, 0.46); | |
| 25 | - box-shadow: -1px 5px 14px 0px rgba(50, 46, 50, 0.46); | |
| 26 | - padding:20px;} | |
| 24 | +-moz-box-shadow: -1px 5px 14px 0px rgba(50, 46, 50, 0.46); | |
| 25 | +box-shadow: -1px 5px 14px 0px rgba(50, 46, 50, 0.46); | |
| 26 | +padding:20px;} | |
| 27 | 27 | |
| 28 | 28 | nav.top{background:#f5f5f5;padding:10px 0px;border-bottom:1px solid #d2d2d2;font-size:12px;} | 
| 29 | 29 | nav.top ul{list-style:none;margin:0px;padding:0px;} | 
| ... | ... | @@ -64,14 +64,10 @@ nav input[type="submit"]{width:35px;height:29px;border:none;background:url('../i | 
| 64 | 64 | .basket a:link,.basket a:visited{text-decoration:none;color:#000000;font-size:18px;} | 
| 65 | 65 | |
| 66 | 66 | .basket span.more {margin-bottom: -1px} | 
| 67 | -.menu{ | |
| 68 | - background:#596065; | |
| 69 | - /*border:1px solid #e8e8e8;*/ | |
| 70 | -} | |
| 67 | +.menu{background:#596065;border:1px solid #e8e8e8;} | |
| 71 | 68 | .menu ul{margin:0px;padding:0px;list-style:none;} | 
| 72 | -.menu ul li{float:left;border-left:1px solid #e8e8e8;} | |
| 73 | -.menu ul li:first-child{border-left:none;} | |
| 74 | -.menu ul li a{float:left;padding:15px 20px 15px 20px;text-transform: uppercase;color:#ffffff;font-size:14px;text-decoration: none;} | |
| 69 | +.menu ul li{float:left;border-right:1px solid #e8e8e8;} | |
| 70 | +.menu ul li a{float:left;padding:15px 20px 15px 20px;text-transform: uppercase;color:#ffffff;font-size:14px;font-weight:bold;text-decoration: none;} | |
| 75 | 71 | .menu ul li a:hover{color:#e5e4e4;} | 
| 76 | 72 | .menu ul li.active a{background:#f5f5f5;color:#596065;} | 
| 77 | 73 | |
| ... | ... | @@ -83,7 +79,7 @@ nav input[type="submit"]{width:35px;height:29px;border:none;background:url('../i | 
| 83 | 79 | |
| 84 | 80 | .fr ul li{border:none;} | 
| 85 | 81 | .akciya a{background:#f75d50;color:#ffffff;} | 
| 86 | -.brands a{background:#95ba2f;color:#ffffff;} | |
| 82 | +.brends a{background:#95ba2f;color:#ffffff;} | |
| 87 | 83 | |
| 88 | 84 | a.myorders{color:#f75d50} | 
| 89 | 85 | |
| ... | ... | @@ -201,26 +197,26 @@ ul.product_colors li img{border:1px solid #d2d2d2;} | 
| 201 | 197 | |
| 202 | 198 | |
| 203 | 199 | .modal_box{ | 
| 204 | - position: fixed; | |
| 205 | - left: 0; | |
| 206 | - top: 0; | |
| 207 | - width: 100%; | |
| 208 | - height: 100%; | |
| 209 | - z-index: 999; | |
| 210 | - | |
| 211 | - background: #000; | |
| 212 | - filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50); /* IE 5.5+*/ | |
| 213 | - -moz-opacity: 0.5; /* Mozilla 1.6 РС‘ РР…РС‘РВ¶РВµ */ | |
| 214 | - -khtml-opacity: 0.5; /* Konqueror 3.1, Safari 1.1 */ | |
| 215 | - opacity: 0.5; | |
| 216 | - | |
| 200 | + position: fixed; | |
| 201 | + left: 0; | |
| 202 | + top: 0; | |
| 203 | + width: 100%; | |
| 204 | + height: 100%; | |
| 205 | + z-index: 999; | |
| 206 | + | |
| 207 | + background: #000; | |
| 208 | +filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50); /* IE 5.5+*/ | |
| 209 | +-moz-opacity: 0.5; /* Mozilla 1.6 Рё РЅРёР¶Рµ */ | |
| 210 | +-khtml-opacity: 0.5; /* Konqueror 3.1, Safari 1.1 */ | |
| 211 | +opacity: 0.5; | |
| 212 | + | |
| 217 | 213 | } | 
| 218 | 214 | #data_box{position:absolute;top:100px;z-index:1000;width:400px;background:#ffffff; | 
| 219 | - -webkit-box-shadow: 0 0 15px #000; | |
| 220 | - -moz-box-shadow: 0 0 15px #000; | |
| 221 | - box-shadow: 0 0 15px #000; | |
| 222 | - border:7px solid #1b9bb6; | |
| 223 | - border-radius:5px; | |
| 215 | + -webkit-box-shadow: 0 0 15px #000; | |
| 216 | + -moz-box-shadow: 0 0 15px #000; | |
| 217 | + box-shadow: 0 0 15px #000; | |
| 218 | + border:7px solid #1b9bb6; | |
| 219 | + border-radius:5px; | |
| 224 | 220 | } | 
| 225 | 221 | #data_box .data_wrp{padding:25px 15px 15px 15px;} | 
| 226 | 222 | #data_box .data_wrp h1{text-transform: uppercase;} | 
| ... | ... | @@ -233,10 +229,10 @@ ul.product_colors li img{border:1px solid #d2d2d2;} | 
| 233 | 229 | .rightbar .control-label{float:left;width:80px;padding-top:5px;} | 
| 234 | 230 | .form-control{outline:0;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0px 5px 0px;font-size:14px;text-indent:10px;margin-bottom:3px;width:250px;} | 
| 235 | 231 | .form-control:focus { | 
| 236 | - border:#1b9bb6 1px solid; | |
| 237 | - box-shadow: 0 0 10px #1b9bb6; | |
| 238 | - -webkit-box-shadow: 0 0 10px #1b9bb6; | |
| 239 | - -moz-box-shadow: 0 0 10px #1b9bb6; | |
| 232 | +border:#1b9bb6 1px solid; | |
| 233 | +box-shadow: 0 0 10px #1b9bb6; | |
| 234 | +-webkit-box-shadow: 0 0 10px #1b9bb6; | |
| 235 | +-moz-box-shadow: 0 0 10px #1b9bb6; | |
| 240 | 236 | } | 
| 241 | 237 | .help-block{color:red;font-size:12px;margin-bottom:5px;} | 
| 242 | 238 | |
| ... | ... | @@ -341,22 +337,22 @@ ul.social {margin-top: 20px;} | 
| 341 | 337 | transition: all 0.5s ease-out; | 
| 342 | 338 | } | 
| 343 | 339 | .social .fb{background-position:-44px 0; | 
| 344 | - cursor: pointer; | |
| 340 | +cursor: pointer; | |
| 345 | 341 | } | 
| 346 | 342 | .social .vk{ | 
| 347 | - cursor: pointer; | |
| 343 | +cursor: pointer; | |
| 348 | 344 | } | 
| 349 | 345 | .social .vk:hover{background-color:#5B7FA6;} | 
| 350 | 346 | .social .fb:hover{background-color:#354f89; | 
| 351 | 347 | } | 
| 352 | 348 | .social .gp{background-position:-132px 0; | 
| 353 | - cursor: pointer;} | |
| 349 | +cursor: pointer;} | |
| 354 | 350 | .social .gp:hover{background-color:#c72f21;} | 
| 355 | 351 | .social .tw{background-position:-144px 0; | 
| 356 | - cursor: pointer;} | |
| 352 | +cursor: pointer;} | |
| 357 | 353 | .social .tw:hover{background-color:#6398c9;} | 
| 358 | 354 | .social .ok{background-position:-89px 0; | 
| 359 | - cursor: pointer;} | |
| 355 | +cursor: pointer;} | |
| 360 | 356 | .social .ok:hover{background-color:#f88f15;} | 
| 361 | 357 | .social ul li a:hover{ | 
| 362 | 358 | background-color:#065baa; | 
| ... | ... | @@ -830,8 +826,8 @@ a.active{font-weight:bold;text-decoration: underline;} | 
| 830 | 826 | -webkit-font-smoothing: antialiased; | 
| 831 | 827 | } | 
| 832 | 828 | .sort_block ul li a.asc:after { | 
| 833 | - content: "↓"; | |
| 829 | + content: "↑"; | |
| 834 | 830 | } | 
| 835 | 831 | .sort_block ul li a.desc:after { | 
| 836 | - content: "↑"; | |
| 832 | + content: "↓"; | |
| 837 | 833 | } | 
| 838 | 834 | \ No newline at end of file | ... | ... | 
9.21 KB
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace frontend\widgets; | |
| 4 | + | |
| 5 | +use common\modules\product\models\Category; | |
| 6 | +use common\modules\product\models\CategorySearch; | |
| 7 | +use Yii; | |
| 8 | +use yii\base\Widget; | |
| 9 | +use yii\web\View; | |
| 10 | +use yii\helpers\Url; | |
| 11 | + | |
| 12 | +class Rubrics extends Widget { | |
| 13 | + public $active; | |
| 14 | + | |
| 15 | + public $wrapper = ''; | |
| 16 | + | |
| 17 | + public function run() | |
| 18 | + { | |
| 19 | + if (!empty($this->active)) { | |
| 20 | + $this->active = Yii::$app->request->get('category'); | |
| 21 | + } | |
| 22 | + if (!is_object($this->active)) { | |
| 23 | + $this->active = CategorySearch::findByAlias($this->active); | |
| 24 | + } | |
| 25 | + if (!empty($this->active)) { | |
| 26 | + $this->active = $this->active->category_id; | |
| 27 | + } | |
| 28 | + $items = []; | |
| 29 | + foreach (Category::find ()->all () as $category) { | |
| 30 | + $items[] = $category;[ | |
| 31 | + 'label' => $category->name , | |
| 32 | + 'url' => Url::to(['catalog/category', 'category' => $category]), | |
| 33 | + 'active' => !empty($categoryObject) && $categoryObject->alias == $category->alias ? true : false, | |
| 34 | + ]; | |
| 35 | + } | |
| 36 | + | |
| 37 | + return $this->render('rubrics', ['items' => $items, 'wrapper' => $this->wrapper, 'active' => $this->active]); | |
| 38 | + } | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... | 
| 1 | +<?php | |
| 2 | +use yii\widgets\Menu; | |
| 3 | +?> | |
| 4 | +<?php if(!empty($wrapper)) :?> | |
| 5 | +<div class="<?= $wrapper?>"> | |
| 6 | +<?php endif?> | |
| 7 | +<ul> | |
| 8 | + <?= $active?> | |
| 9 | +<?php foreach($items as $i => $category) :?> | |
| 10 | + <li class="item<?= $category->alias?><?= ($active == $category->category_id ? ' active' : '')?>"><?= \yii\helpers\Html::a($category->name, ['catalog/category', 'category' => $category])?></li> | |
| 11 | +<?php endforeach;?> | |
| 12 | +</ul> | |
| 13 | +<?php if(!empty($wrapper)) :?> | |
| 14 | + <div class="both"></div> | |
| 15 | +</div> | |
| 16 | +<?php endif?> | |
| 0 | 17 | \ No newline at end of file | ... | ... |