コード例 #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->dataProvider)) {
         $this->dataProvider = new ArrayDataProvider(['allModels' => $this->basket->getItems($this->itemType), 'pagination' => false]);
     }
     parent::init();
 }
コード例 #2
0
ファイル: view.php プロジェクト: Hrachkhachatryan/yii2
    <br/>

    <div class="col-md-5">Due amount:</div>
    <div class="col-md-4"><?php 
echo \Yii::$app->ecom->formatter->asPrice($order->due_amount);
?>
</div>
    <br/>

    <div class="col-md-5">Customer #:</div>
    <div class="col-md-4"><?php 
echo $order->user_id;
?>
</div>
    <br/>
    <h4>Order items</h4>
    <?php 
echo \opus\ecom\widgets\GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => $order->getOrderLines()->with('product'), 'pagination' => false]), 'columns' => [['class' => \yii\grid\SerialColumn::className()], 'product.name', 'quantity', 'due_amount:price']]);
if ($order->status === 'new') {
    echo Html::a('Go to payment', ['payment/pay', 'orderId' => $order->id], ['class' => 'btn btn-lg btn-danger']);
}
?>
</div>

<div class="row col-lg-offset-4 ">
    <h4>Invoices</h4>
    <?php 
echo \opus\ecom\widgets\GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => $order->getInvoices(), 'pagination' => false]), 'columns' => [['class' => \yii\grid\SerialColumn::className()], 'due_amount:price:Amount', 'due_datetime:datetime:Deadline', 'created:datetime:Created']]);
echo Html::a('Issue a new invoice', ['order/new-invoice', 'orderId' => $order->id], ['class' => 'btn btn-lg btn-success']);
?>
</div>
コード例 #3
0
ファイル: list.php プロジェクト: opus-online/yii2-app-ecom
<?php

/**
 * @author Ivo Kund <*****@*****.**>
 * @date 24.01.14
 * @var \yii\web\View $this
 * @var \yii\data\ActiveDataProvider $dataProvider
 */
?>

<h1>Payment log</h1>
<?php 
echo \opus\ecom\widgets\GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id:text:#', 'user_id:text:User', 'bank_code', 'status', 'amount:price', 'created:datetime', ['class' => \yii\grid\ActionColumn::className(), 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return \yii\helpers\Html::a('Details', ['payment/view', 'paymentId' => $model->id]);
}]]]]);
コード例 #4
0
ファイル: index.php プロジェクト: Hrachkhachatryan/yii2
    <div class="body-content">

        <div class="row">
            <div class="col-lg-3">
                <h2>Users</h2>

                <?php 
echo GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\ar\User::find(), 'pagination' => false]), 'columns' => ['id', 'name']]);
?>
            </div>
            <div class="col-lg-8">
                <h2>Products</h2>

                <?php 
echo GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\ar\Product::find(), 'pagination' => false]), 'columns' => ['id', 'name', 'price:price', ['class' => \yii\grid\ActionColumn::className(), 'buttons' => ['add-product' => function ($url) {
    return \yii\helpers\Html::a('Add to basket', $url);
}], 'template' => '{add-product}', 'controller' => 'basket']]]);
?>

                <h2>Discounts</h2>
                <?php 
echo GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\ar\Discount::find(), 'pagination' => false]), 'columns' => ['label', ['class' => \yii\grid\ActionColumn::className(), 'buttons' => ['add-discount' => function ($url) {
    return \yii\helpers\Html::a('Apply discount', $url);
}], 'template' => '{add-discount}', 'controller' => 'basket']]]);
?>
            </div>
        </div>
    </div>
</div>