Commit 38f7295da8515def2516dfdab33676b7ab5ae230

Authored by Yarik
1 parent 887985c7

Product admin search fix

common/components/Request.php
1 <?php 1 <?php
2 -namespace common\components;  
3 -  
4 -class Request extends \yii\web\Request  
5 -  
6 -{  
7 -  
8 - public $web;  
9 -  
10 - public $adminUrl;  
11 -  
12 -  
13 -  
14 - public function getBaseUrl()  
15 - 2 + namespace common\components;
  3 +
  4 + class Request extends \yii\web\Request
16 { 5 {
17 -  
18 -  
19 - return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl;  
20 -  
21 - }  
22 -  
23 -  
24 -  
25 - public function resolvePathInfo()  
26 -  
27 - {  
28 -  
29 - if ($this->getUrl() === $this->adminUrl) {  
30 -  
31 - return "";  
32 -  
33 - } else {  
34 -  
35 - return parent::resolvePathInfo();  
36 - 6 +
  7 + public $web;
  8 +
  9 + public $adminUrl;
  10 +
  11 + /**
  12 + * @inheritdoc
  13 + */
  14 + public function getBaseUrl()
  15 + {
  16 + return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl;
  17 + }
  18 +
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function resolvePathInfo()
  23 + {
  24 + if($this->getUrl() === $this->adminUrl) {
  25 + return "";
  26 + } else {
  27 + return parent::resolvePathInfo();
  28 + }
37 } 29 }
38 -  
39 - }  
40 -  
41 -}  
42 \ No newline at end of file 30 \ No newline at end of file
  31 + }
43 \ No newline at end of file 32 \ No newline at end of file
common/modules/product/models/ProductSearch.php
@@ -141,6 +141,8 @@ @@ -141,6 +141,8 @@
141 ], 141 ],
142 ]); 142 ]);
143 143
  144 + $this->load($params);
  145 +
144 if(isset( $this->is_top )) { 146 if(isset( $this->is_top )) {
145 $query->andWhere([ 147 $query->andWhere([
146 'is_top' => (bool) $this->is_top, 148 'is_top' => (bool) $this->is_top,
frontend/controllers/SiteController.php
@@ -78,12 +78,13 @@ @@ -78,12 +78,13 @@
78 { 78 {
79 $categories = Category::find() 79 $categories = Category::find()
80 ->where([ 'depth' => 0 ]) 80 ->where([ 'depth' => 0 ])
81 - ->joinWith('lang', true, 'INNER JOIN') 81 + ->orderBy('category_id')
  82 + ->joinWith('lang')
82 ->all(); 83 ->all();
83 $purposes = TaxGroup::find() 84 $purposes = TaxGroup::find()
84 ->where([ 85 ->where([
85 'tax_group.tax_group_id' => 5, 86 'tax_group.tax_group_id' => 5,
86 - 'level' => 0, 87 + 'level' => 0,
87 ]) 88 ])
88 ->joinWith('options.lang') 89 ->joinWith('options.lang')
89 ->one(); 90 ->one();
@@ -93,7 +94,7 @@ @@ -93,7 +94,7 @@
93 3, 94 3,
94 4, 95 4,
95 ], 96 ],
96 - 'status' => 1, 97 + 'status' => 1,
97 ]) 98 ])
98 ->joinWith('lang', true, 'INNER JOIN') 99 ->joinWith('lang', true, 'INNER JOIN')
99 ->all(); 100 ->all();
@@ -241,7 +242,10 @@ @@ -241,7 +242,10 @@
241 242
242 public function actionPage($id) 243 public function actionPage($id)
243 { 244 {
244 - $model = Page::find()->where(['page.id' => $id])->joinWith('lang', true, 'INNER JOIN')->one(); 245 + $model = Page::find()
  246 + ->where([ 'page.id' => $id ])
  247 + ->joinWith('lang', true, 'INNER JOIN')
  248 + ->one();
245 if(empty( $model )) { 249 if(empty( $model )) {
246 throw new NotFoundHttpException(); 250 throw new NotFoundHttpException();
247 } 251 }