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 | 29 | $pathInfo = $request->getPathInfo(); |
| 30 | 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 | 26 | $modelOrder->deleteBasketMod($_GET['deleteID']); |
| 27 | 27 | return Yii::$app->response->redirect(['basket/index']); |
| 28 | 28 | } |
| 29 | - | |
| 29 | + | |
| 30 | 30 | if(isset($_POST['update']) && isset($_POST['ProductVariant'])){ |
| 31 | 31 | |
| 32 | 32 | foreach ($_POST['ProductVariant'] as $index=>$row) { |
| ... | ... | @@ -40,7 +40,7 @@ class BasketController extends Controller |
| 40 | 40 | $body .= "\n\r"; |
| 41 | 41 | } |
| 42 | 42 | $body .= "\n\r"; |
| 43 | - | |
| 43 | + | |
| 44 | 44 | if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save()) { |
| 45 | 45 | $productV = $_POST['ProductVariant']; |
| 46 | 46 | |
| ... | ... | @@ -129,8 +129,8 @@ class BasketController extends Controller |
| 129 | 129 | return $this->redirect(['basket/success', |
| 130 | 130 | ]); |
| 131 | 131 | } |
| 132 | - } | |
| 133 | - | |
| 132 | + } | |
| 133 | + | |
| 134 | 134 | $basket_mods = $modelOrder->getBasketMods(); |
| 135 | 135 | |
| 136 | 136 | if(!empty(Yii::$app->user->id)){ |
| ... | ... | @@ -141,12 +141,12 @@ class BasketController extends Controller |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | - | |
| 144 | + | |
| 145 | 145 | return $this->render('index', [ |
| 146 | 146 | 'modelMod'=>$modelMod, |
| 147 | 147 | 'basket_mods'=>$basket_mods, |
| 148 | 148 | 'modelOrder'=>$modelOrder, |
| 149 | - ]); | |
| 149 | + ]); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function actionItems(){ |
| ... | ... | @@ -168,7 +168,7 @@ class BasketController extends Controller |
| 168 | 168 | 'basket_mods'=>$basket_mods, |
| 169 | 169 | ]); |
| 170 | 170 | } |
| 171 | - | |
| 171 | + | |
| 172 | 172 | public function actionInfo() |
| 173 | 173 | { |
| 174 | 174 | $modelMod = new Orders(); |
| ... | ... | @@ -176,8 +176,8 @@ class BasketController extends Controller |
| 176 | 176 | return $this->renderAjax('ajax_info', [ |
| 177 | 177 | 'info'=>$info, |
| 178 | 178 | ]); |
| 179 | - } | |
| 180 | - | |
| 179 | + } | |
| 180 | + | |
| 181 | 181 | public function actionAdd(){ |
| 182 | 182 | $modelOrders = new Orders(); |
| 183 | 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 | 19 | var go_product = function(data){ |
| 20 | 20 | var product_id = data.product_id; |
| 21 | 21 | $.get("/basket/add/", data , |
| 22 | - function(data){ | |
| 22 | + function(data){ | |
| 23 | 23 | //alert_msg("Товар добавлен<br /> в корзину",product_id); |
| 24 | 24 | popup(0,'.black'); |
| 25 | 25 | start_basket(); |
| 26 | - }); | |
| 26 | + }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| ... | ... | @@ -97,8 +97,8 @@ |
| 97 | 97 | // }, |
| 98 | 98 | //}); |
| 99 | 99 | } |
| 100 | - | |
| 101 | - var start_basket = function(){ | |
| 100 | + | |
| 101 | + var start_basket = function(){ | |
| 102 | 102 | $.get("/basket/info/", |
| 103 | 103 | function(data){ |
| 104 | 104 | $(basket_id).html(data); | ... | ... |