Commit 8fef08bca000e60d7749b01606b915a2105854fb
1 parent
14009e7f
Structure data fix and removed some unnessessary features.
Showing
14 changed files
with
127 additions
and
619 deletions
Show diff stats
backend/controllers/BlogController.php deleted
1 | -<?php | |
2 | - | |
3 | -namespace backend\controllers; | |
4 | -use developeruz\db_rbac\behaviors\AccessBehavior; | |
5 | -use common\models\Fields; | |
6 | -use Yii; | |
7 | -use common\models\Blog; | |
8 | -use common\models\BlogSearch; | |
9 | -use yii\web\Controller; | |
10 | -use yii\web\NotFoundHttpException; | |
11 | -use yii\filters\VerbFilter; | |
12 | -use yii\filters\AccessControl; | |
13 | -/** | |
14 | - * BlogController implements the CRUD actions for Blog model. | |
15 | - */ | |
16 | -class BlogController extends Controller | |
17 | -{ | |
18 | - | |
19 | - /** | |
20 | - * @inheritdoc | |
21 | - */ | |
22 | - public function behaviors() | |
23 | - { | |
24 | - return [ | |
25 | - 'access'=>[ | |
26 | - 'class' => AccessBehavior::className(), | |
27 | - 'rules' => | |
28 | - ['site' => | |
29 | - [ | |
30 | - [ | |
31 | - 'actions' => ['login', 'error'], | |
32 | - 'allow' => true, | |
33 | - ] | |
34 | - ] | |
35 | - ] | |
36 | - ], | |
37 | - 'verbs' => [ | |
38 | - 'class' => VerbFilter::className(), | |
39 | - 'actions' => [ | |
40 | - 'logout' => ['post'], | |
41 | - ], | |
42 | - ], | |
43 | - ]; | |
44 | - } | |
45 | - | |
46 | - /** | |
47 | - * Lists all Blog models. | |
48 | - * @return mixed | |
49 | - */ | |
50 | - public function actionIndex() | |
51 | - { | |
52 | - $searchModel = new BlogSearch(); | |
53 | - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
54 | - | |
55 | - return $this->render('index', [ | |
56 | - 'searchModel' => $searchModel, | |
57 | - 'dataProvider' => $dataProvider, | |
58 | - ]); | |
59 | - } | |
60 | - | |
61 | - /** | |
62 | - * Displays a single Blog model. | |
63 | - * @param integer $id | |
64 | - * @return mixed | |
65 | - */ | |
66 | - public function actionView($id) | |
67 | - { | |
68 | - return $this->render('view', [ | |
69 | - 'model' => $this->findModel($id), | |
70 | - ]); | |
71 | - } | |
72 | - | |
73 | - /** | |
74 | - * Creates a new Blog model. | |
75 | - * If creation is successful, the browser will be redirected to the 'view' page. | |
76 | - * @return mixed | |
77 | - */ | |
78 | - public function actionCreate() | |
79 | - { | |
80 | - $model = new Blog(); | |
81 | - | |
82 | - if ($model->load(Yii::$app->request->post())) { | |
83 | - | |
84 | - Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); | |
85 | - | |
86 | - if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) { | |
87 | - $model->cover = $image->name; | |
88 | - } | |
89 | - | |
90 | - if ($model->save() && $image) { | |
91 | - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); | |
92 | - } | |
93 | - | |
94 | - return $this->redirect(['view', 'id' => $model->blog_id]); | |
95 | - } else { | |
96 | - return $this->render('create', [ | |
97 | - 'model' => $model, | |
98 | - ]); | |
99 | - } | |
100 | - } | |
101 | - | |
102 | - /** | |
103 | - * Updates an existing Blog model. | |
104 | - * If update is successful, the browser will be redirected to the 'view' page. | |
105 | - * @param integer $id | |
106 | - * @return mixed | |
107 | - */ | |
108 | - public function actionUpdate($id) | |
109 | - { | |
110 | - $model = $this->findModel($id); | |
111 | - | |
112 | - if ($model->load(Yii::$app->request->post())) { | |
113 | - | |
114 | - Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); | |
115 | - | |
116 | - if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) { | |
117 | - $model->cover = $image->name; | |
118 | - } | |
119 | - | |
120 | - if ($model->save() && $image) { | |
121 | - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); | |
122 | - } | |
123 | - | |
124 | - return $this->redirect(['view', 'id' => $model->blog_id]); | |
125 | - } else { | |
126 | - return $this->render('update', [ | |
127 | - 'model' => $model, | |
128 | - ]); | |
129 | - } | |
130 | - } | |
131 | - | |
132 | - /** | |
133 | - * Deletes an existing Blog model. | |
134 | - * If deletion is successful, the browser will be redirected to the 'index' page. | |
135 | - * @param integer $id | |
136 | - * @return mixed | |
137 | - */ | |
138 | - public function actionDelete($id) | |
139 | - { | |
140 | - $this->findModel($id)->delete(); | |
141 | - | |
142 | - return $this->redirect(['index']); | |
143 | - } | |
144 | - | |
145 | - /** | |
146 | - * Finds the Blog model based on its primary key value. | |
147 | - * If the model is not found, a 404 HTTP exception will be thrown. | |
148 | - * @param integer $id | |
149 | - * @return Blog the loaded model | |
150 | - * @throws NotFoundHttpException if the model cannot be found | |
151 | - */ | |
152 | - protected function findModel($id) | |
153 | - { | |
154 | - if (($model = Blog::findOne($id)) !== null) { | |
155 | - return $model; | |
156 | - } else { | |
157 | - throw new NotFoundHttpException('The requested page does not exist.'); | |
158 | - } | |
159 | - } | |
160 | -} |
backend/views/blog/_form.php deleted
1 | -<?php | |
2 | - | |
3 | -use common\widgets\FieldEditor; | |
4 | -use yii\helpers\Html; | |
5 | -use yii\widgets\ActiveForm; | |
6 | -use common\modules\file\widgets\ImageUploader; | |
7 | -use mihaildev\ckeditor\CKEditor; | |
8 | -use mihaildev\elfinder\ElFinder; | |
9 | -use common\components\Request; | |
10 | - | |
11 | -/* @var $this yii\web\View */ | |
12 | -/* @var $model common\models\Blog */ | |
13 | -/* @var $form yii\widgets\ActiveForm */ | |
14 | -?> | |
15 | - | |
16 | -<div class="blog-form"> | |
17 | - | |
18 | - <?php $form = ActiveForm::begin([ | |
19 | - 'enableClientValidation' => false, | |
20 | - 'options' => ['enctype' => 'multipart/form-data'] | |
21 | - ]); ?> | |
22 | - | |
23 | - <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
24 | - | |
25 | - <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?> | |
26 | - | |
27 | - <?= $form->field($model, 'description')->widget(CKEditor::className(), | |
28 | - [ | |
29 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
30 | - 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
31 | - 'inline' => false, //по умолчанию false]), | |
32 | - 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | |
33 | - ] | |
34 | - ) | |
35 | - ]) ?> | |
36 | - | |
37 | - <?= $form->field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [ | |
38 | - 'language' => 'ru', | |
39 | - 'options' => [ | |
40 | - 'accept' => 'image/*', | |
41 | - 'multiple' => false, | |
42 | - ], | |
43 | - 'pluginOptions' => [ | |
44 | - 'allowedFileExtensions' => ['jpg', 'gif', 'png'], | |
45 | - 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', | |
46 | - 'overwriteInitial' => true, | |
47 | - 'showRemove' => false, | |
48 | - 'showUpload' => false, | |
49 | - 'previewFileType' => 'image', | |
50 | - ], | |
51 | - ]); ?> | |
52 | - | |
53 | - <?= FieldEditor::widget([ | |
54 | - 'template' => 'education', | |
55 | - 'item_id' => $model->blog_id, | |
56 | - 'model' => 'common\models\Blog', | |
57 | - 'language' => 'ru', | |
58 | - ]); ?> | |
59 | - <div class="form-group"> | |
60 | - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
61 | - </div> | |
62 | - | |
63 | - <?php ActiveForm::end(); ?> | |
64 | - | |
65 | -</div> |
backend/views/blog/_search.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\ActiveForm; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\BlogSearch */ | |
8 | -/* @var $form yii\widgets\ActiveForm */ | |
9 | -?> | |
10 | - | |
11 | -<div class="blog-search"> | |
12 | - | |
13 | - <?php $form = ActiveForm::begin([ | |
14 | - 'action' => ['index'], | |
15 | - 'method' => 'get', | |
16 | - ]); ?> | |
17 | - | |
18 | - <?= $form->field($model, 'blog_id') ?> | |
19 | - | |
20 | - <?= $form->field($model, 'user_id') ?> | |
21 | - | |
22 | - <?= $form->field($model, 'name') ?> | |
23 | - | |
24 | - <?= $form->field($model, 'link') ?> | |
25 | - | |
26 | - <?= $form->field($model, 'date_add') ?> | |
27 | - | |
28 | - <?php // echo $form->field($model, 'user_add_id') ?> | |
29 | - | |
30 | - <?php // echo $form->field($model, 'view_count') ?> | |
31 | - | |
32 | - <?php // echo $form->field($model, 'description') ?> | |
33 | - | |
34 | - <?php // echo $form->field($model, 'cover') ?> | |
35 | - | |
36 | - <div class="form-group"> | |
37 | - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
38 | - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
39 | - </div> | |
40 | - | |
41 | - <?php ActiveForm::end(); ?> | |
42 | - | |
43 | -</div> |
backend/views/blog/create.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | - | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Blog */ | |
8 | - | |
9 | -$this->title = 'Create Blog'; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
12 | -?> | |
13 | -<div class="blog-create"> | |
14 | - | |
15 | - <h1><?= Html::encode($this->title) ?></h1> | |
16 | - | |
17 | - <?= $this->render('_form', [ | |
18 | - 'model' => $model, | |
19 | - ]) ?> | |
20 | - | |
21 | -</div> |
backend/views/blog/index.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\grid\GridView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $searchModel common\models\BlogSearch */ | |
8 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | - | |
10 | -$this->title = 'Blogs'; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
12 | -?> | |
13 | -<div class="blog-index"> | |
14 | - | |
15 | - <h1><?= Html::encode($this->title) ?></h1> | |
16 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | - | |
18 | - <p> | |
19 | - <?= Html::a('Create Blog', ['create'], ['class' => 'btn btn-success']) ?> | |
20 | - </p> | |
21 | - <?= GridView::widget([ | |
22 | - 'dataProvider' => $dataProvider, | |
23 | - 'filterModel' => $searchModel, | |
24 | - 'columns' => [ | |
25 | - ['class' => 'yii\grid\SerialColumn'], | |
26 | - | |
27 | - 'blog_id', | |
28 | - 'user_id', | |
29 | - 'name', | |
30 | - 'link', | |
31 | - 'date_add', | |
32 | - // 'user_add_id', | |
33 | - // 'view_count', | |
34 | - // 'description:ntext', | |
35 | - // 'cover', | |
36 | - | |
37 | - ['class' => 'yii\grid\ActionColumn'], | |
38 | - ], | |
39 | - ]); ?> | |
40 | -</div> |
backend/views/blog/update.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | - | |
5 | -/* @var $this yii\web\View */ | |
6 | -/* @var $model common\models\Blog */ | |
7 | - | |
8 | -$this->title = 'Update Blog: ' . ' ' . $model->name; | |
9 | -$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']]; | |
10 | -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->blog_id]]; | |
11 | -$this->params['breadcrumbs'][] = 'Update'; | |
12 | -?> | |
13 | -<div class="blog-update"> | |
14 | - | |
15 | - <h1><?= Html::encode($this->title) ?></h1> | |
16 | - | |
17 | - <?= $this->render('_form', [ | |
18 | - 'model' => $model, | |
19 | - ]) ?> | |
20 | - | |
21 | -</div> |
backend/views/blog/view.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\DetailView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\models\Blog */ | |
8 | - | |
9 | -$this->title = $model->name; | |
10 | -$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']]; | |
11 | -$this->params['breadcrumbs'][] = $this->title; | |
12 | -?> | |
13 | -<div class="blog-view"> | |
14 | - | |
15 | - <h1><?= Html::encode($this->title) ?></h1> | |
16 | - | |
17 | - <p> | |
18 | - <?= Html::a('Update', ['update', 'id' => $model->blog_id], ['class' => 'btn btn-primary']) ?> | |
19 | - <?= Html::a('Delete', ['delete', 'id' => $model->blog_id], [ | |
20 | - 'class' => 'btn btn-danger', | |
21 | - 'data' => [ | |
22 | - 'confirm' => 'Are you sure you want to delete this item?', | |
23 | - 'method' => 'post', | |
24 | - ], | |
25 | - ]) ?> | |
26 | - </p> | |
27 | - | |
28 | - <?= DetailView::widget([ | |
29 | - 'model' => $model, | |
30 | - 'attributes' => [ | |
31 | - 'blog_id', | |
32 | - 'user_id', | |
33 | - 'name', | |
34 | - 'link', | |
35 | - 'date_add', | |
36 | - 'user_add_id', | |
37 | - 'view_count', | |
38 | - 'description:ntext', | |
39 | - 'cover', | |
40 | - ], | |
41 | - ]) ?> | |
42 | - | |
43 | -</div> |
common/models/Articles.php
... | ... | @@ -5,6 +5,7 @@ namespace common\models; |
5 | 5 | use common\behaviors\RatingBehavior; |
6 | 6 | use common\modules\comment\models\CommentModel; |
7 | 7 | use Yii; |
8 | +use yii\db\ActiveQuery; | |
8 | 9 | |
9 | 10 | /** |
10 | 11 | * This is the model class for table "articles". |
... | ... | @@ -20,9 +21,12 @@ use Yii; |
20 | 21 | * @property string $meta_description |
21 | 22 | * @property string $seo_text |
22 | 23 | * @property string $h1 |
24 | + * | |
25 | + * @todo Two same methods: getImageFile(), getImageUrl() | |
23 | 26 | */ |
24 | 27 | class Articles extends \yii\db\ActiveRecord |
25 | 28 | { |
29 | + | |
26 | 30 | public $imageUpload; |
27 | 31 | |
28 | 32 | /** |
... | ... | @@ -86,16 +90,25 @@ class Articles extends \yii\db\ActiveRecord |
86 | 90 | 'h1' => 'H1', |
87 | 91 | ]; |
88 | 92 | } |
89 | - | |
93 | + | |
94 | + /** | |
95 | + * @return bool|null|string | |
96 | + */ | |
90 | 97 | public function getImageFile() { |
91 | 98 | return empty($this->image) ? null : Yii::getAlias('@imagesDir/articles/'. $this->image); |
92 | 99 | } |
93 | - | |
100 | + | |
101 | + /** | |
102 | + * @return bool|null|string | |
103 | + */ | |
94 | 104 | public function getImageUrl() |
95 | 105 | { |
96 | 106 | return empty($this->image) ? null : Yii::getAlias('@imagesUrl/articles/' . $this->image); |
97 | 107 | } |
98 | 108 | |
109 | + /** | |
110 | + * @return bool | |
111 | + */ | |
99 | 112 | public function recalculateRating() { |
100 | 113 | /** |
101 | 114 | * @var ArticleToRating $averageRating |
... | ... | @@ -117,10 +130,16 @@ class Articles extends \yii\db\ActiveRecord |
117 | 130 | } |
118 | 131 | } |
119 | 132 | |
133 | + /** | |
134 | + * @return ActiveQuery | |
135 | + */ | |
120 | 136 | public function getComments() { |
121 | 137 | return $this->hasMany(CommentModel::className(), ['entity_id' => 'id'])->where(['artbox_comment.entity' => self::className(), 'artbox_comment.status' => CommentModel::STATUS_ACTIVE, 'artbox_comment.artbox_comment_pid' => NULL]); |
122 | 138 | } |
123 | 139 | |
140 | + /** | |
141 | + * @return ActiveQuery | |
142 | + */ | |
124 | 143 | public function getAverageRating() { |
125 | 144 | return $this->hasOne(ArticleToRating::className(), ['articles_id' => 'id']); |
126 | 145 | } | ... | ... |
common/modules/comment/views/artbox_comment_item.php
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | <?php |
36 | 36 | if(!empty( $model->rating )) { |
37 | 37 | ?> |
38 | - <div class="user_rating" itemporp="reviewRating" itemscope itemtype="http://schema.org/Rating"> | |
38 | + <div class="user_rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> | |
39 | 39 | <span itemprop="worstRating" style="display: none">1</span> |
40 | 40 | <span itemprop="ratingValue" style="display: none"><?php echo $model->rating->value; ?></span> |
41 | 41 | <span itemprop="bestRating" style="display: none">5</span> | ... | ... |
common/modules/rubrication/behaviors/ArtboxSynonymBehavior.php
... | ... | @@ -7,10 +7,7 @@ use dosamigos\transliterator\TransliteratorHelper; |
7 | 7 | use yii\base\Behavior; |
8 | 8 | use yii\base\Exception; |
9 | 9 | use yii\db\ActiveRecord; |
10 | -use Yii; | |
11 | -use yii\helpers\ArrayHelper; | |
12 | 10 | use yii\helpers\Inflector; |
13 | -use yii\web\NotFoundHttpException; | |
14 | 11 | |
15 | 12 | class ArtboxSynonymBehavior extends Behavior { |
16 | 13 | ... | ... |
console/migrations/m160811_143339_delete_blog_column.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160811_143339_delete_blog_column extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->dropTable('{{%blog}}'); | |
10 | + } | |
11 | + | |
12 | + public function down() | |
13 | + { | |
14 | + $tableOptions = null; | |
15 | + | |
16 | + $this->createTable('{{%blog}}', [ | |
17 | + 'blog_id' => $this->primaryKey(), | |
18 | + 'user_id' => $this->integer()->notNull(), | |
19 | + 'name' => $this->string(255)->notNull(), | |
20 | + 'link' => $this->string(255), | |
21 | + 'date_add' => $this->timestamp()->notNull(), | |
22 | + 'user_add_id' => $this->integer(), | |
23 | + 'view_count' => $this->integer()->defaultValue(0), | |
24 | + 'description' => $this->text(), | |
25 | + 'cover' => $this->string(255), | |
26 | + ], $tableOptions); | |
27 | + } | |
28 | +} | ... | ... |
frontend/controllers/ProductsController.php deleted
1 | -<?php | |
2 | - | |
3 | -namespace frontend\controllers; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\web\Controller; | |
7 | -use yii\web\HttpException; | |
8 | -use yii\data\Pagination; | |
9 | -use yii\web\Session; | |
10 | -use common\models\Catalog; | |
11 | -use common\models\Products; | |
12 | -use common\models\Mod; | |
13 | -use common\models\Filters; | |
14 | -use common\models\ProductsFilters; | |
15 | -use common\models\ProductsType; | |
16 | -use common\models\ProductsBrends; | |
17 | -use common\models\ViewProduct; | |
18 | - | |
19 | -class ProductsController extends Controller | |
20 | -{ | |
21 | - public function actionIndex () | |
22 | - { | |
23 | - $modelProducts = new Products; | |
24 | - $modelProducts->load ($_POST); | |
25 | - if (! $catalog = Catalog::find ()->where (['translit' => $_GET['translit']])->with ('parent')->one ()) | |
26 | - throw new HttpException(404, 'Данной странице не существует!'); | |
27 | - $query = Products::find ()->where ('catalog_id=:catalog_id OR catalog_parent_id=:catalog_parent_id', [':catalog_id' => $catalog->id, ':catalog_parent_id' => $catalog->id])->with (['catalog'])->innerJoinWith (['cost']); | |
28 | - if (! empty($_POST['Products']['minCost']) && ! empty($_POST['Products']['maxCost'])) $query->andWhere ('(cost>=:minCost and cost<=:maxCost)', [':minCost' => $_POST['Products']['minCost'], ':maxCost' => $_POST['Products']['maxCost']]); | |
29 | - if (! empty($_GET['brends'])) | |
30 | - { | |
31 | - $b = explode (';', $_GET['brends']); | |
32 | - $query->andWhere (['brend_id' => $b]); | |
33 | - } | |
34 | - if (! empty($_GET['filters'])) | |
35 | - { | |
36 | - $l = explode (';', $_GET['filters']); | |
37 | - $items = Filters::find ()->where (['parent_id' => 0])->all (); | |
38 | - foreach ($items as $key => $it) | |
39 | - { | |
40 | - $f = []; | |
41 | - foreach ($it->childs as $c) | |
42 | - { | |
43 | - if (in_array ($c['id'], $l)) $f[] = $c['id']; | |
44 | - } | |
45 | - if (count ($f) > 0) | |
46 | - $query->innerJoin ('productsFilters as filter_' . $key, 'filter_' . $key . '.product_id=products.id')->andWhere (['filter_' . $key . '.filter_id' => $f]); | |
47 | - // $childs->leftJoin('productsFilters as pf_'.$key, 'pf_'.$key.'.product_id = productsFilters.product_id')->andWhere(['pf_'.$key.'.filter_id'=>$f]); | |
48 | - } | |
49 | - } | |
50 | - if (! empty($modelProducts->fasovka)) | |
51 | - { | |
52 | - $query->innerJoinWith (['fasovka'])->andWhere ([ProductsFasovka::tableName () . '.fasovka_id' => $modelProducts->fasovka]); | |
53 | - } | |
54 | - if (! empty($modelProducts->type)) | |
55 | - { | |
56 | - $query->innerJoinWith (['type'])->andWhere ([ProductsType::tableName () . '.type_id' => $modelProducts->type]); | |
57 | - } | |
58 | - if (! empty($modelProducts->brends)) | |
59 | - { | |
60 | - $query->innerJoinWith (['brends'])->andWhere ([ProductsBrends::tableName () . '.brend_id' => $modelProducts->brends]); | |
61 | - } | |
62 | - $query->groupBy (['id']); | |
63 | - $countQuery = clone $query; | |
64 | - $pages = new Pagination(['totalCount' => $countQuery->count (), 'pageSize' => 15]); | |
65 | - $pages->forcePageParam = false; | |
66 | - $pages->pageSizeParam = false; | |
67 | - $products = $query->offset ($pages->offset) | |
68 | - ->limit ($pages->limit) | |
69 | - ->all (); | |
70 | - | |
71 | - return $this->render ('index', [ | |
72 | - 'modelProducts' => $modelProducts, | |
73 | - 'catalog' => $catalog, | |
74 | - 'pages' => $pages, | |
75 | - 'products' => $products, | |
76 | - ]); | |
77 | - } | |
78 | - | |
79 | - public function actionSearch () | |
80 | - { | |
81 | - $query = Products::find ()->innerJoinWith (['catalog'])->innerJoinWith (['cost'])->innerJoinWith (['brend']); | |
82 | - if (! empty($_GET['search_str'])) | |
83 | - { | |
84 | - $query->andWhere (['like', 'products.name', $_GET['search_str']]); | |
85 | - $query->orWhere (['like', 'catalog.name', $_GET['search_str']]); | |
86 | - $query->orWhere (['like', 'catalog_brends.name', $_GET['search_str']]); | |
87 | - $query->orWhere (['like', 'mod.art', $_GET['search_str']]); | |
88 | - } | |
89 | - $query->groupBy (['id']); | |
90 | - $countQuery = clone $query; | |
91 | - $pages = new Pagination(['totalCount' => $countQuery->count (), 'pageSize' => 20]); | |
92 | - $pages->forcePageParam = false; | |
93 | - $pages->pageSizeParam = false; | |
94 | - $products = $query->offset ($pages->offset) | |
95 | - ->limit ($pages->limit) | |
96 | - ->all (); | |
97 | - | |
98 | - return $this->render ('search', [ | |
99 | - 'pages' => $pages, | |
100 | - 'products' => $products, | |
101 | - ]); | |
102 | - } | |
103 | - | |
104 | - public function actionShow () | |
105 | - { | |
106 | - if (! $catalog = Catalog::find ()->where (['translit' => $_GET['translit_rubric']])->with ('parent')->one ()) | |
107 | - throw new HttpException(404, 'Данной странице не существует!'); | |
108 | - if (! $product = Products::find ()->where (['id' => $_GET['id']])->one ()) | |
109 | - throw new HttpException(404, 'Данной странице не существует!'); | |
110 | - ViewProduct::add ($product->id); | |
111 | - | |
112 | - return $this->render ('show', [ | |
113 | - 'catalog' => $catalog, | |
114 | - 'product' => $product, | |
115 | - ]); | |
116 | - } | |
117 | - | |
118 | - public function actionCompare () | |
119 | - { | |
120 | - $session = new Session; | |
121 | - $session->open (); | |
122 | - if (! empty($_GET['id'])) | |
123 | - { | |
124 | - $i = 0; | |
125 | - if (isset($session['compare'])) | |
126 | - { | |
127 | - foreach ($session['compare'] as $key => $compare) | |
128 | - { | |
129 | - if ($_GET['id'] == $compare) | |
130 | - { | |
131 | - $i++; | |
132 | - } | |
133 | - } | |
134 | - } | |
135 | - if ($i == 0) | |
136 | - { | |
137 | - $data[] = $_GET['id']; | |
138 | - $session['compare'] = $data; | |
139 | - } | |
140 | - Yii::$app->getSession ()->setFlash ('success', 'Этот товар добавлен к сравнению!'); | |
141 | - | |
142 | - return $this->redirect (Yii::$app->request->referrer); | |
143 | - } | |
144 | - else | |
145 | - { | |
146 | - //print_r($session['compare']); | |
147 | - $products = Products::find ()->where (['id' => $session['compare']])->all (); | |
148 | - | |
149 | - return $this->render ('compare', [ | |
150 | - 'products' => $products, | |
151 | - ]); | |
152 | - } | |
153 | - } | |
154 | -} | |
155 | 0 | \ No newline at end of file |
frontend/views/catalog/products.php
... | ... | @@ -178,6 +178,11 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ |
178 | 178 | |
179 | 179 | <div class="content" itemscope itemtype="http://schema.org/Product"> |
180 | 180 | <div itemprop="name"><h1><?= Seo::widget([ 'row'=>'h1'])?></h1></div> |
181 | + <div itemprop="offers" itemscope itemtype="http://schema.org/AggregateOffer" style="display: none;"> | |
182 | + <span itemprop="priceCurrency">UAH</span> | |
183 | + <span itemprop="lowPrice"><?= $priceLimits['min'] ?></span> | |
184 | + <span itemprop="highPrice"><?= $priceLimits['max'] ?></span> | |
185 | + </div> | |
181 | 186 | <div class="sort_menu"> |
182 | 187 | |
183 | 188 | <div class="sort_block"> | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -177,15 +177,17 @@ $this->registerJs(" |
177 | 177 | <div class="wrap br f"> |
178 | 178 | |
179 | 179 | <div class="header"> |
180 | - <div class="phone"> | |
181 | - <div class="tel"> | |
182 | - (044) 303 90 15<br/> | |
183 | - (093) 911 05 03<br/> | |
184 | - (095) 004 56 55<br/> | |
185 | - (068) 083 62 01 | |
180 | + <div itemscope itemtype="http://schema.org/Organization"> | |
181 | + <div class="phone"> | |
182 | + <div class="tel"> | |
183 | + <span itemprop="telephone">(044) 303 90 15</span><br/> | |
184 | + <span itemprop="telephone">(093) 911 05 03</span><br/> | |
185 | + <span itemprop="telephone">(095) 004 56 55</span><br/> | |
186 | + <span itemprop="telephone">(068) 083 62 01</span> | |
187 | + </div> | |
188 | + <a href="mailto:rukza4ok@eltrade.com.ua" itemprop="email">rukza4ok@eltrade.com.ua</a> | |
189 | + <!-- <a href="#" id='call'>Обратный звонок</a>--> | |
186 | 190 | </div> |
187 | - <a href="mailto:rukza4ok@eltrade.com.ua">rukza4ok@eltrade.com.ua</a> | |
188 | - <!-- <a href="#" id='call'>Обратный звонок</a>--> | |
189 | 191 | </div> |
190 | 192 | <div class="basket"> |
191 | 193 | <div id="basket" class="info">Корзина <span>0</span></div> |
... | ... | @@ -392,66 +394,70 @@ $this->registerJs(" |
392 | 394 | ?> |
393 | 395 | </div> |
394 | 396 | |
395 | - <div class="leftbar"> | |
396 | - <ul> | |
397 | - <li><a href="<?= Url::to (['articles/index']) ?>">Блог</a></li> | |
398 | - <li><a href="<?= Url::to (['text/index', 'translit' => 'oplata-i-dostavka']) ?>">Оплата и | |
399 | - доставка</a></li> | |
400 | - <li><a href="<?= Url::to (['iam/index']) ?>">Личный кабинет</a></li> | |
401 | - <li><a href="<?= Url::to (['event/index']) ?>">Акции</a></li> | |
402 | - <li><a href="<?= Url::to (['text/index', 'translit' => 'contacts']) ?>">О магазине</a></li> | |
403 | - </ul> | |
404 | - | |
405 | - | |
406 | - <div class="phones"> | |
407 | - (044) 303 90 15<br/> | |
408 | - (093) 911 05 03<br/> | |
409 | - (095) 004 56 55<br/> | |
410 | - (068) 083 62 01 | |
397 | + <div itemscope itemtype="http://schema.org/Organization"> | |
398 | + | |
399 | + <div class="leftbar"> | |
400 | + <ul> | |
401 | + <li><a href="<?= Url::to (['articles/index']) ?>">Блог</a></li> | |
402 | + <li><a href="<?= Url::to (['text/index', 'translit' => 'oplata-i-dostavka']) ?>">Оплата и | |
403 | + доставка</a></li> | |
404 | + <li><a href="<?= Url::to (['iam/index']) ?>">Личный кабинет</a></li> | |
405 | + <li><a href="<?= Url::to (['event/index']) ?>">Акции</a></li> | |
406 | + <li><a href="<?= Url::to (['text/index', 'translit' => 'contacts']) ?>">О магазине</a></li> | |
407 | + </ul> | |
408 | + | |
409 | + | |
410 | + <div class="phones"> | |
411 | + <span itemprop="telephone">(044) 303 90 15</span><br/> | |
412 | + <span itemprop="telephone">(093) 911 05 03</span><br/> | |
413 | + <span itemprop="telephone">(095) 004 56 55</span><br/> | |
414 | + <span itemprop="telephone">(068) 083 62 01</span> | |
415 | + </div> | |
416 | + | |
417 | + <a class="footer-mail" href="mailto:rukza4ok@eltrade.com.ua" itemprop="email">rukza4ok@eltrade.com.ua</a> | |
418 | + | |
411 | 419 | </div> |
412 | - | |
413 | - <a class="footer-mail" href="mailto:rukza4ok@eltrade.com.ua">rukza4ok@eltrade.com.ua</a> | |
414 | - | |
415 | - </div> | |
416 | - | |
417 | - <div class="content2"> | |
418 | - <p class="txts">Подписаться на акции</p> | |
419 | - <?php | |
420 | - $subscribe = new Subscribe; | |
421 | - $form = ActiveForm::begin (['action' => '/subscribe']); | |
422 | - ?> | |
423 | - <?php echo $form->field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail', 'enableAjaxValidation' => true])->label (false); ?> | |
424 | - <?= $form->field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка', 'enableAjaxValidation' => true])->label (false); ?> | |
425 | - <div class="saletxt">укажите желаемый размер скидки</div> | |
426 | - <?php echo Html::submitButton (' Подписаться ', ['class' => 'submit4m']); ?> | |
427 | - <?php ActiveForm::end (); ?> | |
428 | - | |
429 | - <div class="header-time footer_time"> | |
430 | - <table> | |
431 | - <tr> | |
432 | - <td> | |
433 | - <table> | |
434 | - <tr> | |
435 | - <td><span>Режим работы:</span></td> | |
436 | - </tr> | |
437 | - <tr> | |
438 | - <td>пн-пт с 10.00 - 19.00</td> | |
439 | - </tr> | |
440 | - <tr> | |
441 | - <td>сб с 10.00 - 17.00</td> | |
442 | - </tr> | |
443 | - <tr> | |
444 | - <td>вс выходной</td> | |
445 | - </tr> | |
446 | - </table> | |
447 | - </td> | |
448 | - </tr> | |
449 | - </table> | |
420 | + | |
421 | + <div class="content2"> | |
422 | + <p class="txts">Подписаться на акции</p> | |
423 | + <?php | |
424 | + $subscribe = new Subscribe; | |
425 | + $form = ActiveForm::begin (['action' => '/subscribe']); | |
426 | + ?> | |
427 | + <?php echo $form->field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail', 'enableAjaxValidation' => true])->label (false); ?> | |
428 | + <?= $form->field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка', 'enableAjaxValidation' => true])->label (false); ?> | |
429 | + <div class="saletxt">укажите желаемый размер скидки</div> | |
430 | + <?php echo Html::submitButton (' Подписаться ', ['class' => 'submit4m']); ?> | |
431 | + <?php ActiveForm::end (); ?> | |
432 | + | |
433 | + <div class="header-time footer_time" itemscope itemtype="http://schema.org/LocalBusiness"> | |
434 | + <table> | |
435 | + <tr> | |
436 | + <td> | |
437 | + <table> | |
438 | + <tr> | |
439 | + <td><span>Режим работы:</span></td> | |
440 | + </tr> | |
441 | + <tr> | |
442 | + <td itemprop="openingHours" datetime="Mo-Fr 10:00-19:00">пн-пт с 10.00 - 19.00</td> | |
443 | + </tr> | |
444 | + <tr> | |
445 | + <td itemprop="openingHours" datetime="Sa 10:00-17:00">сб с 10.00 - 17.00</td> | |
446 | + </tr> | |
447 | + <tr> | |
448 | + <td>вс выходной</td> | |
449 | + </tr> | |
450 | + </table> | |
451 | + </td> | |
452 | + </tr> | |
453 | + </table> | |
454 | + </div> | |
455 | + | |
456 | + | |
457 | + <div class="both"></div> | |
458 | + | |
450 | 459 | </div> |
451 | - | |
452 | - | |
453 | - <div class="both"></div> | |
454 | - | |
460 | + | |
455 | 461 | </div> |
456 | 462 | |
457 | 463 | <div class="both"></div> | ... | ... |