diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php
index d4fed28..daf471a 100755
--- a/backend/views/page/_form.php
+++ b/backend/views/page/_form.php
@@ -40,6 +40,10 @@ use mihaildev\elfinder\ElFinder;
= $form->field($model, 'in_menu')->checkbox() ?>
+ = $form->field($model, 'in_top_menu')->checkbox() ?>
+
+ = $form->field($model, 'sort_order')->textInput() ?>
+
= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
diff --git a/common/models/Blog.php b/common/models/Blog.php
index 9225e75..148d23b 100755
--- a/common/models/Blog.php
+++ b/common/models/Blog.php
@@ -3,6 +3,7 @@
namespace common\models;
use common\behaviors\SaveImgBehavior;
+use common\modules\comment\models\CommentModel;
use Yii;
/**
diff --git a/common/models/Comments.php b/common/models/Comments.php
new file mode 100644
index 0000000..50d1dd3
--- /dev/null
+++ b/common/models/Comments.php
@@ -0,0 +1,26 @@
+where([
+// 'entity_id' => 'id',
+// 'artbox_comment.entity' => self::className(),
+// 'artbox_comment.status' => CommentModel::STATUS_ACTIVE,
+// 'artbox_comment.artbox_comment_pid' => NULL
+// ]);
+// }
+}
diff --git a/common/models/Page.php b/common/models/Page.php
index 1bf0df5..b8329d5 100755
--- a/common/models/Page.php
+++ b/common/models/Page.php
@@ -14,6 +14,8 @@
* @property string $seo_text
* @property string $h1
* @property bool $in_menu
+ * @property bool $in_top_menu
+ * @property string $sort_order
*/
class Page extends \yii\db\ActiveRecord
{
@@ -49,6 +51,12 @@
return [
[
[
+ 'sort_order'
+ ],
+ 'integer'
+ ],
+ [
+ [
'body',
'seo_text',
],
@@ -69,6 +77,7 @@
[
[
'in_menu',
+ 'in_top_menu'
],
'boolean',
],
@@ -98,7 +107,9 @@
'meta_description' => 'Meta Description',
'seo_text' => 'Seo Text',
'h1' => 'H1',
- 'in_menu' => 'Show in menu',
+ 'in_menu' => 'Show in main menu',
+ 'in_top_menu' => 'Show in top menu',
+ 'sort_order' => 'Sort order',
];
}
}
diff --git a/common/modules/comment/Module.php b/common/modules/comment/Module.php
index cb0473c..13e301a 100755
--- a/common/modules/comment/Module.php
+++ b/common/modules/comment/Module.php
@@ -56,7 +56,7 @@
*
* @var bool
*/
- public static $enableRating = true;
+ public static $enableRating = false;
/**
* Initializes the module.
diff --git a/console/migrations/m160929_141228_columns_for_page_table.php b/console/migrations/m160929_141228_columns_for_page_table.php
new file mode 100644
index 0000000..7ee7125
--- /dev/null
+++ b/console/migrations/m160929_141228_columns_for_page_table.php
@@ -0,0 +1,18 @@
+addColumn('page', 'in_top_menu', $this->boolean()->defaultValue(false));
+ $this->addColumn('page', 'sort_order', $this->integer()->defaultValue(1));
+ }
+
+ public function down()
+ {
+ $this->dropColumn('page', 'in_top_menu');
+ $this->dropColumn('page', 'sort_order');
+ }
+}
diff --git a/frontend/config/main.php b/frontend/config/main.php
index 4afa489..25c7ad4 100755
--- a/frontend/config/main.php
+++ b/frontend/config/main.php
@@ -49,7 +49,6 @@ return [
'route_map' => [
'catalog' => 'catalog/category',
'product' => 'catalog/product',
-
]
],
'/' => 'site/index',
diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php
index a586edd..6ee760f 100755
--- a/frontend/controllers/CatalogController.php
+++ b/frontend/controllers/CatalogController.php
@@ -155,10 +155,12 @@ class CatalogController extends \yii\web\Controller
$stockProgram = Category::find()
->where([
'stock_program' => true,
+ 'parent_id' => $category->category_id,
])->all();
$onOrder = Category::find()
->where([
'on_order' => true,
+ 'parent_id' => $category->category_id,
])->all();
return $this->render('products', [
'category' => $category,
diff --git a/frontend/controllers/CommentsController.php b/frontend/controllers/CommentsController.php
new file mode 100644
index 0000000..4a7d581
--- /dev/null
+++ b/frontend/controllers/CommentsController.php
@@ -0,0 +1,13 @@
+render('index');
+ }
+}
diff --git a/frontend/controllers/DiscountController.php b/frontend/controllers/DiscountController.php
new file mode 100644
index 0000000..dbfdadc
--- /dev/null
+++ b/frontend/controllers/DiscountController.php
@@ -0,0 +1,27 @@
+where([
+ 'akciya' => true,
+ ])->with('variant', 'category')
+ ->all();
+ if (!empty($products))
+ {
+ return $this->render('discount', [
+ 'products' => $products,
+ ]);
+ }
+ else
+ {
+ return $this->render('empty');
+ }
+ }
+}
\ No newline at end of file
diff --git a/frontend/views/blog/view.php b/frontend/views/blog/view.php
index 1c35c8d..48e36dd 100755
--- a/frontend/views/blog/view.php
+++ b/frontend/views/blog/view.php
@@ -5,6 +5,8 @@
* @var View $this
*/
use common\models\Blog;
+use common\models\Comments;
+use common\modules\comment\widgets\CommentWidget;
use yii\helpers\Url;
use yii\web\View;
diff --git a/frontend/views/comments/index.php b/frontend/views/comments/index.php
new file mode 100644
index 0000000..614a09d
--- /dev/null
+++ b/frontend/views/comments/index.php
@@ -0,0 +1,19 @@
+
+
+
+ 1,
+]);
+echo CommentWidget::widget([
+ 'model' => $comments,
+ 'entityIdAttribute' => 'id'
+]);
+?>
\ No newline at end of file
diff --git a/frontend/views/discount/discount.php b/frontend/views/discount/discount.php
new file mode 100644
index 0000000..852a6d1
--- /dev/null
+++ b/frontend/views/discount/discount.php
@@ -0,0 +1,50 @@
+title = 'Акции';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
+
Акции
+
+
+
+
Стильные элитные обои для вашего дома
+
Продумывая дизайн своей квартиры, мы непременно тщательно выбираем "одежду" для стен - красивые модные обои.
+
fdsfsdf
+
+
+
diff --git a/frontend/views/discount/empty.php b/frontend/views/discount/empty.php
new file mode 100644
index 0000000..ff58473
--- /dev/null
+++ b/frontend/views/discount/empty.php
@@ -0,0 +1,10 @@
+title = 'Акции';
+$this->params['breadcrumbs'][] = $this->title;
+
+echo "Товары не найдены";
\ No newline at end of file
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php
index ace10d0..2e1bdc6 100755
--- a/frontend/views/layouts/main.php
+++ b/frontend/views/layouts/main.php
@@ -3,14 +3,29 @@
* @var Category[] $brands_menu
* @var \yii\web\View $this
* @var string $content
+ * @var Page[] $top_menu
+ * @var Page[] $main_menu
*/
+use common\models\Page;
use common\modules\product\models\Category;
use frontend\assets\AppAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;
+$top_menu = Page::find()->where([
+ 'in_top_menu' => true,
+])->orderBy([
+ 'sort_order' => SORT_ASC,
+])->all();
+
+$main_menu = Page::find()->where([
+ 'in_menu' => true,
+])->orderBy([
+ 'sort_order' => SORT_ASC,
+])->all();
+
$this->registerMetaTag([
'name' => 'robots',
'content' => 'noindex,nofollow',
@@ -39,11 +54,12 @@ $brands = Category::find()
beginBody(); ?>
@@ -74,10 +90,9 @@ $brands = Category::find()
'id' => 19,
]); ?>">Обои
Текстиль
- Карнизы
- Напольные покрытия
- Contract Concept
- Мебель
+
+ title; ?>
+
diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php
index 32220b3..884be12 100755
--- a/frontend/views/site/index.php
+++ b/frontend/views/site/index.php
@@ -49,8 +49,8 @@ $this->title = "Главная";