Skip to content

Commit

Permalink
Work at cart functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Oct 23, 2015
1 parent b678fd5 commit 8e036f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public function actionIndex()
{
$dataProvider = new ArrayDataProvider([
'allModels' => Yii::$app->cart->getPositions(),
'sort' => [
'attributes' => ['id', 'name', 'period'],
],
'pagination' => [
'pageSize' => 10,
],
Expand Down
25 changes: 19 additions & 6 deletions src/views/cart/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,29 @@
'dataProvider' => $dataProvider,
'layout' => "{items}\n{pager}",
'columns' => [
'name',
[
'attribute' => 'name',
'format' => 'raw',
'value' => function ($model) {
return $model->icon . ' ' . $model->name . ' ' . Html::tag('span', $model->description, ['class' => 'text-muted']);
}
],
[
'class' => XEditableColumn::className(),
'attribute' => 'period',
'pluginOptions' => [
'type' => 'select',
'source' => [
'1' => '1 year',
'2' => '2 year',
'3' => '3 year',
],
],
'widgetOptions' => [
'scenario' => 'some-scenario',
]
],
'description',
'price',
'actions' => [
'class' => ActionColumn::className(),
'template' => '{remove}',
Expand Down Expand Up @@ -78,11 +92,11 @@
<tbody>
<tr>
<th style="width:50%"><?= Yii::t('app', 'Subtotal') ?>:</th>
<td>$250.30</td>
<td>0</td>
</tr>
<tr>
<th><?= Yii::t('app', 'Discount') ?>:</th>
<td>$5.80</td>
<td>0</td>
</tr>
<tr>
<th><?= Yii::t('app', 'Total') ?>:</th>
Expand All @@ -100,8 +114,7 @@
<div class="row no-print">
<div class="col-xs-12">
<?= Html::a('<i class="fa fa-refresh"></i> ' . Yii::t('app', 'Clear cart'), ['clear'], ['class' => 'btn btn-default']); ?>
<button class="btn btn-success pull-right"><i
class="fa fa-credit-card"></i> <?= Yii::t('app', 'Make oreder'); ?></button>
<?= Html::a('<i class="fa fa-credit-card"></i> ' . Yii::t('app', 'Make oreder'), ['clear'], ['class' => 'btn btn-success pull-right']); ?>
</div>
</div>
</section>

0 comments on commit 8e036f2

Please sign in to comment.