Commit 3a7e43ce2e72433d516e77236a07fc5c6ad5cc22
1 parent
a59e31bb
20.07.16
Showing
3 changed files
with
18 additions
and
15 deletions
Show diff stats
common/modules/product/CatalogUrlManager.php
@@ -29,8 +29,11 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -29,8 +29,11 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
29 | $pathInfo = $request->getPathInfo(); | 29 | $pathInfo = $request->getPathInfo(); |
30 | $paths = explode('/', $pathInfo); | 30 | $paths = explode('/', $pathInfo); |
31 | 31 | ||
32 | - if(strripos($request->url,$pathInfo.'?') && (!strripos($request->url,'?page')) && (!strripos($request->url,'?sort'))){ | ||
33 | - throw new HttpException(404 ,'Page not found'); | 32 | + if(isset($paths[1])) { |
33 | + if(strripos($request->url,'catalog/'.$paths[1].'?') && (!strripos($request->url,'?page')) && (!strripos($request->url,'?sort'))){ | ||
34 | + throw new HttpException(404 ,'Page not found'); | ||
35 | + } | ||
36 | + | ||
34 | } | 37 | } |
35 | 38 | ||
36 | 39 |
frontend/controllers/BasketController.php
@@ -26,7 +26,7 @@ class BasketController extends Controller | @@ -26,7 +26,7 @@ class BasketController extends Controller | ||
26 | $modelOrder->deleteBasketMod($_GET['deleteID']); | 26 | $modelOrder->deleteBasketMod($_GET['deleteID']); |
27 | return Yii::$app->response->redirect(['basket/index']); | 27 | return Yii::$app->response->redirect(['basket/index']); |
28 | } | 28 | } |
29 | - | 29 | + |
30 | if(isset($_POST['update']) && isset($_POST['ProductVariant'])){ | 30 | if(isset($_POST['update']) && isset($_POST['ProductVariant'])){ |
31 | 31 | ||
32 | foreach ($_POST['ProductVariant'] as $index=>$row) { | 32 | foreach ($_POST['ProductVariant'] as $index=>$row) { |
@@ -40,7 +40,7 @@ class BasketController extends Controller | @@ -40,7 +40,7 @@ class BasketController extends Controller | ||
40 | $body .= "\n\r"; | 40 | $body .= "\n\r"; |
41 | } | 41 | } |
42 | $body .= "\n\r"; | 42 | $body .= "\n\r"; |
43 | - | 43 | + |
44 | if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save()) { | 44 | if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save()) { |
45 | $productV = $_POST['ProductVariant']; | 45 | $productV = $_POST['ProductVariant']; |
46 | 46 | ||
@@ -129,8 +129,8 @@ class BasketController extends Controller | @@ -129,8 +129,8 @@ class BasketController extends Controller | ||
129 | return $this->redirect(['basket/success', | 129 | return $this->redirect(['basket/success', |
130 | ]); | 130 | ]); |
131 | } | 131 | } |
132 | - } | ||
133 | - | 132 | + } |
133 | + | ||
134 | $basket_mods = $modelOrder->getBasketMods(); | 134 | $basket_mods = $modelOrder->getBasketMods(); |
135 | 135 | ||
136 | if(!empty(Yii::$app->user->id)){ | 136 | if(!empty(Yii::$app->user->id)){ |
@@ -141,12 +141,12 @@ class BasketController extends Controller | @@ -141,12 +141,12 @@ class BasketController extends Controller | ||
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | - | 144 | + |
145 | return $this->render('index', [ | 145 | return $this->render('index', [ |
146 | 'modelMod'=>$modelMod, | 146 | 'modelMod'=>$modelMod, |
147 | 'basket_mods'=>$basket_mods, | 147 | 'basket_mods'=>$basket_mods, |
148 | 'modelOrder'=>$modelOrder, | 148 | 'modelOrder'=>$modelOrder, |
149 | - ]); | 149 | + ]); |
150 | } | 150 | } |
151 | 151 | ||
152 | public function actionItems(){ | 152 | public function actionItems(){ |
@@ -168,7 +168,7 @@ class BasketController extends Controller | @@ -168,7 +168,7 @@ class BasketController extends Controller | ||
168 | 'basket_mods'=>$basket_mods, | 168 | 'basket_mods'=>$basket_mods, |
169 | ]); | 169 | ]); |
170 | } | 170 | } |
171 | - | 171 | + |
172 | public function actionInfo() | 172 | public function actionInfo() |
173 | { | 173 | { |
174 | $modelMod = new Orders(); | 174 | $modelMod = new Orders(); |
@@ -176,8 +176,8 @@ class BasketController extends Controller | @@ -176,8 +176,8 @@ class BasketController extends Controller | ||
176 | return $this->renderAjax('ajax_info', [ | 176 | return $this->renderAjax('ajax_info', [ |
177 | 'info'=>$info, | 177 | 'info'=>$info, |
178 | ]); | 178 | ]); |
179 | - } | ||
180 | - | 179 | + } |
180 | + | ||
181 | public function actionAdd(){ | 181 | public function actionAdd(){ |
182 | $modelOrders = new Orders(); | 182 | $modelOrders = new Orders(); |
183 | if(isset($_GET['mod_id'],$_GET['count']) && $_GET['mod_id']>0 && $_GET['count']>0){ | 183 | if(isset($_GET['mod_id'],$_GET['count']) && $_GET['mod_id']>0 && $_GET['count']>0){ |
frontend/web/js/basket.js
@@ -19,11 +19,11 @@ | @@ -19,11 +19,11 @@ | ||
19 | var go_product = function(data){ | 19 | var go_product = function(data){ |
20 | var product_id = data.product_id; | 20 | var product_id = data.product_id; |
21 | $.get("/basket/add/", data , | 21 | $.get("/basket/add/", data , |
22 | - function(data){ | 22 | + function(data){ |
23 | //alert_msg("Товар добавлен<br /> в корзину",product_id); | 23 | //alert_msg("Товар добавлен<br /> в корзину",product_id); |
24 | popup(0,'.black'); | 24 | popup(0,'.black'); |
25 | start_basket(); | 25 | start_basket(); |
26 | - }); | 26 | + }); |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
@@ -97,8 +97,8 @@ | @@ -97,8 +97,8 @@ | ||
97 | // }, | 97 | // }, |
98 | //}); | 98 | //}); |
99 | } | 99 | } |
100 | - | ||
101 | - var start_basket = function(){ | 100 | + |
101 | + var start_basket = function(){ | ||
102 | $.get("/basket/info/", | 102 | $.get("/basket/info/", |
103 | function(data){ | 103 | function(data){ |
104 | $(basket_id).html(data); | 104 | $(basket_id).html(data); |