Commit 1ab92388f668a17fa78eac0b1cd0acec62f4b7ac
1 parent
a03a5434
VItaliy 22.12.2015
select details
Showing
2 changed files
with
18 additions
and
6 deletions
Show diff stats
frontend/controllers/GoodsController.php
| ... | ... | @@ -10,6 +10,7 @@ namespace frontend\controllers; |
| 10 | 10 | |
| 11 | 11 | use common\components\CustomVarDamp; |
| 12 | 12 | use common\models\DetailsCrosses; |
| 13 | +use common\models\GoodsView; | |
| 13 | 14 | use common\models\GoodsViewSearch; |
| 14 | 15 | use Yii; |
| 15 | 16 | use yii\web\Controller; |
| ... | ... | @@ -26,25 +27,36 @@ class GoodsController extends Controller { |
| 26 | 27 | $brand = $arr_name[0]; |
| 27 | 28 | $article = $arr_name[1]; |
| 28 | 29 | |
| 29 | -// $arr = ['GoodsViewSearch' => ['name' => $article, | |
| 30 | -// 'brand' => $brand]]; | |
| 31 | 30 | |
| 32 | - $arr = ['GoodsViewSearch' => ['name' => '0092S40090', | |
| 33 | - 'brand' => 'BOSCH']]; | |
| 31 | + $arr_values = ['name' => $article, | |
| 32 | + 'brand' => $brand]; | |
| 33 | + $arr = ['GoodsViewSearch' => $arr_values]; | |
| 34 | 34 | |
| 35 | + if(empty( Yii::$app->user->identity )){ | |
| 36 | + $margin_id = 1; | |
| 37 | + }else{ | |
| 38 | + $margin_id = Yii::$app->user->identity->margin_id; | |
| 39 | + } | |
| 40 | + | |
| 41 | +// $arr = ['GoodsViewSearch' => ['name' => '0092S40090', | |
| 42 | +// 'brand' => 'BOSCH']]; | |
| 35 | 43 | |
| 36 | 44 | |
| 37 | 45 | Yii::$app->session->setFlash('price_currency_id', 1); |
| 38 | - Yii::$app->session->setFlash('price_margin_id', 1); | |
| 46 | + Yii::$app->session->setFlash('price_margin_id', $margin_id); | |
| 39 | 47 | |
| 40 | 48 | $searchModel = new GoodsViewSearch(); |
| 41 | 49 | $goods_provider = $searchModel->search($arr); |
| 42 | 50 | |
| 43 | 51 | $crosses_provider = $searchModel->searchCrosses($arr); |
| 44 | 52 | |
| 53 | + // для заголовка таблицы (карточка товара) | |
| 54 | + $detailsModel = GoodsView::findOne($arr_values); | |
| 55 | + | |
| 45 | 56 | return $this->render('index',[ |
| 46 | 57 | 'goods_data_provider' => $goods_provider, |
| 47 | 58 | 'crosses_data_provider' => $crosses_provider, |
| 59 | + 'detailsModel' => $detailsModel, | |
| 48 | 60 | ]); |
| 49 | 61 | } |
| 50 | 62 | ... | ... |
frontend/views/goods/index.php
| ... | ... | @@ -173,7 +173,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 173 | 173 | ?> |
| 174 | 174 | |
| 175 | 175 | <div class="modal fade" id="details_content_block" > |
| 176 | - <div class="modal-dialog table_details"> | |
| 176 | + <div class="modal-dialog"> | |
| 177 | 177 | <div class="modal-content"> |
| 178 | 178 | <div class="modal-header"> |
| 179 | 179 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ... | ... |