index.php
7.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?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;
use common\models\Delivery;
$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("
$('#orders-phone,#orders-phone2').mask('(000) 000-0000');
", View::POS_READY, 'mask');
$this->registerJs("
$('#orders-delivery input[type=\"radio\"]').click(function(){
$('.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">
<h1 class="basket_title_">Корзина</h1>
<div class="ten"></div>
<?php $form = ActiveForm::begin(['enableClientScript' => false]); ?>
<div class="rightbar basket_rightbar">
<div class="form-order">
<div class="input-blocks-group">
<div class="title_groups">контакты</div>
<div class="input-blocks-wrapper">
<?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>
</div>
<div class="input-blocks-group radio_grp">
<div class="input-blocks-wrapper">
<?= $form->field($modelOrder, 'delivery')
->radioList(ArrayHelper::map(Delivery::find()->where(['parent_id'=>0])->asArray()->all(), 'id', 'title'),[
'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>
</div>
<div class="both"></div>
<?php foreach(Delivery::find()->where(['parent_id'=>0])->all() as $item):?>
<div class='delivery-data' id='delivery-data-<?=$item->id?>'>
<?=$item->text?>
<?= $form->field($modelOrder, 'delivery')
->radioList(ArrayHelper::map(Delivery::find()->where(['parent_id'=>$item->id])->asArray()->all(), 'id', 'title'), [
'id'=> 'order-delivery-childs',
'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>
<?php endforeach;?>
<div class="input-blocks-group radio_grp">
<div class="input-blocks-wrapper">
<?php echo $form->field($modelOrder, 'payment')->radioList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом']); ?>
</div>
</div>
<div class="both"></div>
<?php echo $form->field($modelOrder,'body')->textarea(['rows'=>7]); ?>
<?php echo Html::submitButton(' Оформить заказ ',array('class'=>'submit4')); ?>
</div>
</div>
<div class="content">
<?php foreach($basket_mods as $i=>$item):?>
<div class="basket_item">
<a href="<?= Url::to(['catalog/product', 'product' => $item->product,'#' => 'm' .$item->product_variant_id]) ?>">
<?= \common\components\artboximage\ArtboxImageHelper::getImage($item->imageUrl, 'product_basket')?>
</a>
<div class="info">
<a href="<?= Url::to(['catalog/product', 'product' => $item->product,'#' => 'm' .$item->product_variant_id]) ?>" class="link2"><?=$item->product_name?></a>
<p>Код: <?=$item->sku?>, цвет: <?=$item->name?></p>
<?php echo $form->field($item,'['.$i.']id')->hiddenInput()->label(false); ?>
<?php echo $form->field($item,'['.$i.']product_name')->hiddenInput()->label(false); ?>
<?php echo $form->field($item,'['.$i.']sku')->hiddenInput()->label(false); ?>
<?php echo $form->field($item,'['.$i.']name')->hiddenInput()->label(false); ?>
<?php echo $form->field($item,'['.$i.']price')->hiddenInput()->label(false); ?>
<?php echo $form->field($item,'['.$i.']sum_cost')->hiddenInput()->label(false); ?>
<div class="count">
<div class="fr txtf"><span style="color:silver">цена за один <?=$item->price?> грн,</span> цена <?=$item->sum_cost?> грн</div>
<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>
<?php endforeach;?>
<?php echo Html::submitButton(' Пересчитать ',array('name'=>"update",'class'=>'submit4 fl')); ?>
<div class="total">
<?= $form->field($modelOrder, 'total')->hiddenInput(['value'=>$modelOrder->getSumCost()])->label(false); ?>
Общая сумма: <?=$modelOrder->getSumCost();?> грн.
</div>
<div class="both"></div>
</div>
<?= Html::a('Продолжить покупки', ['/site/index'], ['class'=>'btn-success cont_shopping']) ?>
<div class="both"></div>
<?php ActiveForm::end(); ?>
</div>