Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yii\helpers\Html;
- use yii\widgets\DetailView;
- use backend\models\Order;
- use backend\models\OrderStatus;
- use backend\models\Users;
- use common\models\User;
- use backend\models\Product;
- use \yii\helpers\ArrayHelper;
- use \yii\helpers\Helpers;
- /* @var $this yii\web\View */
- /* @var $model backend\models\Order */
- $this->title = $model->id;
- $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']];
- $this->params['breadcrumbs'][] = $this->title;
- \yii\web\YiiAsset::register($this);
- ?>
- <div class="order-view">
- <p>
- <?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
- <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => 'Вы действительно хотите удалить заказ?',
- 'method' => 'post',
- ],
- ]) ?>
- </p>
- <?= DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- 'id',
- [
- 'attribute'=>'status_id',
- 'value'=>function($data){
- return $data->status->name;
- },
- ],
- 'kolichestvo',
- 'summ',
- [
- 'attribute'=>'user_id',
- 'value'=>function($data){
- return $data->users->username;
- },
- ],
- [
- 'attribute'=>'fio',
- 'label' => 'Фамилия',
- 'value'=>function($data){
- return $data->users->fio;
- },
- ],
- [
- 'attribute'=>'phone',
- 'label' => 'Телефон',
- 'value'=>function($data){
- return $data->users->phone;
- },
- ],
- [
- 'attribute'=>'email',
- 'label' => 'E-mail',
- 'value'=>function($data){
- return $data->users->email;
- },
- ],
- [
- 'attribute'=>'company',
- 'label' => 'Компания',
- 'value'=>function($data){
- return $data->users->company;
- },
- ],
- [
- 'attribute'=>'city',
- 'label' => 'Город',
- 'value'=>function($data){
- return $data->users->city;
- },
- ],
- [
- 'attribute'=>'Категория цен',
- 'value' => function($data){
- return $data->users->klass_pokupat ? 'Опт' : 'Розница';
- }
- ],
- 'create_at',
- 'update_at',
- ],
- ]) ?>
- <?php $items=$model->orderItems;?>
- <div class="table-responsive">
- <table class="table table-hover table-striped">
- <thead>
- <tr>
- <th>Наименование</th>
- <th>Цена</th>
- <th>Количество</th>
- <th>Сумма</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach($items as $item):?>
- <tr>
- <td><?=\yii\helpers\Html::a($item['name'], ['product/view', 'id'=>$item['id']])?></td>
- <td><?=$item['price_old']?></td>
- <td><?=$item['kolichestvo_item']?></td>
- <td><?=$item['kolichestvo_item'] * $item['price_old'] ?></td>
- </tr>
- <?php endforeach?>
- <tr>
- <td colspan="4">Итого: </td>
- <td>ЗДЕСЬ количесвто всего товара т.е. поля kolichestvo_item сложить </td>
- </tr>
- <tr>
- <td colspan="4">На сумму: </td>
- <td> ЗДЕСЬ сумма всего заказа поле summ_item в базе данных только не пойму как его туда записывать </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement