Blame view

frontend/views/basket/index.php 9.05 KB
ecf49b1b   Administrator   second
1
2
3
4
5
6
7
  <?php
  use yii\helpers\Url;
  use yii\helpers\Html;
  use yii\web\View;
  use yii\helpers\ArrayHelper;
  use yii\widgets\Breadcrumbs;
  use yii\bootstrap\ActiveForm;
90a6ed1a   Administrator   basket
8
  use common\models\Delivery;
ecf49b1b   Administrator   second
9
10
11
12
13
14
15
16
  
  $this->title = 'Корзина';
  $this->registerMetaTag(['name' => 'description', 'content' => 'Корзина']);
  $this->registerMetaTag(['name' => 'keywords', 'content' => 'Корзина']);
  
  $this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
  
  $this->registerJs("
3af3ecb3   Administrator   image size
17
  $('#orders-phone,#orders-phone2').mask('(000) 000-0000');
ecf49b1b   Administrator   second
18
19
20
21
  ", View::POS_READY, 'mask');
  
  
  $this->registerJs("
3af3ecb3   Administrator   image size
22
  $('#orders-delivery input[type=\"radio\"]').click(function(){
bba33968   Виталий   Веталь
23
      $('.hidden_box').addClass('activeShow')
ecf49b1b   Administrator   second
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
      $('.delivery-data').hide();
      $('#delivery-data-'+$(this).val()).show();
  });
  ", View::POS_READY, 'order-delivery');
  ?>
              <nav class="bread-crumbs">
              <?= Breadcrumbs::widget([
                  'links' => [
                              'Корзина'
                              ],
              ]) ?>
                              <div class="both"></div>
              </nav>
  
  
  
  <div class="layout">
      
e85a9a94   Виталий   Веталь
42
      <h1 class="basket_title_">Корзина</h1>
ecf49b1b   Administrator   second
43
  <div class="ten"></div>
53254ab5   Виталий   Веталь
44
  
ecf49b1b   Administrator   second
45
  <?php $form = ActiveForm::begin(['enableClientScript' => false]); ?>
5fb763b2   Виталий   Веталь
46
  <div class="rightbar basket_rightbar">
84b2aead   Administrator   add active menu
47
   <div class="form-order">
0f76d3d6   Виталий   Веталь
48
49
       <div class="input-blocks-group">
           <div class="title_groups">контакты</div>
034ab0d0   Виталий   Веталь
50
           <div class="input-blocks-wrapper" style="margin-top: 0">
0f76d3d6   Виталий   Веталь
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
               <?php echo $form->field($modelOrder, 'name', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
           <div class="input-blocks-wrapper">
               <?php echo $form->field($modelOrder, 'phone', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
           <div class="input-blocks-wrapper">
               <?php echo $form->field($modelOrder, 'phone2', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
           <div class="input-blocks-wrapper">
               <?php echo $form->field($modelOrder, 'city', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
           <div class="input-blocks-wrapper">
               <?php echo $form->field($modelOrder, 'adress', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
           <div class="input-blocks-wrapper">
               <?php echo $form->field($modelOrder, 'email', [ 'options' => [ 'class' => 'input-blocks basket_input_2' ] ])->textInput([ 'class' => 'custom-input-2' ]); ?>
           </div>
375d6177   Виталий   Веталь
68
       </div>
0f76d3d6   Виталий   Веталь
69
  
bba33968   Виталий   Веталь
70
       <div class="input-blocks-group radio_grp hidden_box">
0f76d3d6   Виталий   Веталь
71
           <div class="input-blocks-wrapper">
459a11d6   Administrator   image size
72
73
74
75
76
               <?php
               $deliveries = ArrayHelper::map(Delivery::find()->where(['parent_id'=>0])->asArray()->all(), 'id', 'title');
               array_pop($deliveries);
               echo $form->field($modelOrder, 'delivery')
                   ->radioList($deliveries,[
0f76d3d6   Виталий   Веталь
77
78
79
80
81
82
83
84
85
86
                       'item' => function($index, $label, $name, $checked, $value) {
                           $return = '<div class="custom-form-buttons">';
                           $return .= '<input class="custom-radio" id="custom-radio-' . $value . '" ' . ( $checked ? "checked" : "" ) . ' type="radio" name="' . $name . '" value="' . $value . '" >';
                           $return .= '<label for="custom-radio-' . $value . '" ><span></span>' . $label . '</label>';
                           $return .= '</div>';
                           return $return;
                       },
                   ])
               ?>
           </div>
a12b9fdd   Виталий   Веталь
87
       </div>
375d6177   Виталий   Веталь
88
  
0f76d3d6   Виталий   Веталь
89
  
ecf49b1b   Administrator   second
90
91
  <div class="both"></div> 
  
90a6ed1a   Administrator   basket
92
  <?php foreach(Delivery::find()->where(['parent_id'=>0])->all() as $item):?>
ecf49b1b   Administrator   second
93
94
  <div class='delivery-data' id='delivery-data-<?=$item->id?>'>
          <?=$item->text?>
7c51adb2   Administrator   image size
95
96
      <?= $form->field($modelOrder, 'delivery')
          ->radioList(ArrayHelper::map(Delivery::find()->where(['parent_id'=>$item->id])->asArray()->all(), 'id', 'title'), [
a8b15d40   Виталий   Веталь
97
              'id'=> 'order-delivery-childs',
7c51adb2   Administrator   image size
98
99
100
101
102
103
104
105
              'item' => function($index, $label, $name, $checked, $value) {
                  $return = '<div class="custom-form-buttons">';
                  $return .= '<input class="custom-radio" id="custom-radio-' . $value . '" ' . ( $checked ? "checked" : "" ) . ' type="radio" name="' . $name . '" value="' . $value . '" >';
                  $return .= '<label for="custom-radio-' . $value . '" ><span></span>' . $label . '</label>';
                  $return .= '</div>';
                  return $return;
              },
          ]);?>
444e4745   Administrator   image size
106
107
  </div>
  
90a6ed1a   Administrator   basket
108
  <?php endforeach;?>
0f76d3d6   Виталий   Веталь
109
110
       <div class="input-blocks-group radio_grp">
           <div class="input-blocks-wrapper">
034ab0d0   Виталий   Веталь
111
112
113
114
115
116
117
118
119
               <?php echo $form->field($modelOrder, 'payment')->radioList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],[
                   'item' => function($index, $label, $name, $checked, $value) {
                       $return = '<div class="custom-form-buttons">';
                       $return .= '<input class="custom-radio" id="custom-radio-' . $value . '" ' . ( $checked ? "checked" : "" ) . ' type="radio" name="' . $name . '" value="' . $value . '" >';
                       $return .= '<label for="custom-radio-' . $value . '" ><span></span>' . $label . '</label>';
                       $return .= '</div>';
                       return $return;
                   },
               ]); ?>
0f76d3d6   Виталий   Веталь
120
121
           </div>
       </div>
ecf49b1b   Administrator   second
122
  
034ab0d0   Виталий   Веталь
123
124
125
  
  
  
ecf49b1b   Administrator   second
126
127
  
  
139413b3   Виталий   Веталь
128
  <div class="input-blocks-group textareagroup" style="border-bottom: none; padding-bottom: 0;">
e27b3a51   Виталий   Веталь
129
      <?php echo $form->field($modelOrder,'body')->textarea(['rows'=>7]); ?>
6e490db6   Виталий   Веталь
130
131
132
      <div class="checkout_basket">
          <?php echo Html::submitButton(' Оформить заказ ',array('class'=>'submit4')); ?>
      </div>
e27b3a51   Виталий   Веталь
133
  
e27b3a51   Виталий   Веталь
134
135
136
  </div>
  
       <div class="both"></div>
034ab0d0   Виталий   Веталь
137
  
ecf49b1b   Administrator   second
138
139
140
141
142
   </div>   
  </div>
  			<div class="content">
                              
                              
90a6ed1a   Administrator   basket
143
  <?php foreach($basket_mods as $i=>$item):?>
ecf49b1b   Administrator   second
144
  			<div class="basket_item">
e6ace78f   Administrator   image size
145
  				<a href="<?= Url::to(['catalog/product', 'product' => $item->product,'#' => 'm' .$item->product_variant_id]) ?>">
38828295   Karnovsky A   -
146
147
                      <?= \common\components\artboximage\ArtboxImageHelper::getImage($item->imageUrl, 'product_basket')?>
                  </a>
ecf49b1b   Administrator   second
148
  				<div class="info">
e6ace78f   Administrator   image size
149
  				<a href="<?= Url::to(['catalog/product', 'product' => $item->product,'#' => 'm' .$item->product_variant_id]) ?>" class="link2"><?=$item->product_name?></a>
90a6ed1a   Administrator   basket
150
  				<p>Код: <?=$item->sku?>, цвет: <?=$item->name?></p>
ecf49b1b   Administrator   second
151
152
                                  <?php echo $form->field($item,'['.$i.']id')->hiddenInput()->label(false); ?>
                                  <?php echo $form->field($item,'['.$i.']product_name')->hiddenInput()->label(false); ?>
90a6ed1a   Administrator   basket
153
                                   <?php echo $form->field($item,'['.$i.']sku')->hiddenInput()->label(false); ?>
ecf49b1b   Administrator   second
154
                                  <?php echo $form->field($item,'['.$i.']name')->hiddenInput()->label(false); ?>
90a6ed1a   Administrator   basket
155
                                  <?php echo $form->field($item,'['.$i.']price')->hiddenInput()->label(false); ?>
ecf49b1b   Administrator   second
156
157
                                  <?php echo $form->field($item,'['.$i.']sum_cost')->hiddenInput()->label(false); ?>
                                  <div class="count">
90a6ed1a   Administrator   basket
158
                                          <div class="fr txtf"><span style="color:silver">цена за один <?=$item->price?> грн,</span> цена <?=$item->sum_cost?> грн</div>
ecf49b1b   Administrator   second
159
160
161
162
163
                                          <label for="count" class="txtf">Количество</label> <?php echo $form->field($item,'['.$i.']count')->textInput(['type'=>'number'])->label(false); ?><div class="both"></div>
  				</div>
  				<a href="<?=Url::to(['basket/index','deleteID'=>$item->id]);?>" class="del">Удалить</a>
  				</div><div class="both"></div>
  			</div>
90a6ed1a   Administrator   basket
164
  <?php endforeach;?>
ecf49b1b   Administrator   second
165
  				
bad7c5c8   Виталий   Веталь
166
167
168
169
                  <div style="margin-top: 10px;">
                      <?php echo Html::submitButton(' Пересчитать ',array('name'=>"update",'class'=>'submit4 fl ')); ?>
                  </div>
  
ecf49b1b   Administrator   second
170
171
  
  			<div class="total">
90a6ed1a   Administrator   basket
172
173
  			<?= $form->field($modelOrder, 'total')->hiddenInput(['value'=>$modelOrder->getSumCost()])->label(false); ?>
                              Общая сумма: <?=$modelOrder->getSumCost();?> грн.
ecf49b1b   Administrator   second
174
  			</div>
878403e2   Виталий   Веталь
175
176
177
178
                  <div class="cont_shopping-wr">
                      <?= Html::a('Продолжить покупки', ['/site/index'], ['class'=>'btn-success cont_shopping']) ?>
                  </div>
  <div class="both"></div>
ecf49b1b   Administrator   second
179
180
181
  
  
  
53254ab5   Виталий   Веталь
182
  			</div>
878403e2   Виталий   Веталь
183
  
53254ab5   Виталий   Веталь
184
      <div class="both"></div>
ecf49b1b   Administrator   second
185
186
187
188
   <?php ActiveForm::end(); ?>			
  			
  			
  </div>