Ejemplo n.º 1
0
 public function actionRemoveFromCart()
 {
     $result = 0;
     $product_id = Yii::$app->request->post('product_id');
     $quantity = Yii::$app->request->post('quantity', true);
     if ($product = Product::findOne(['id' => $product_id, 'is_active' => 1])) {
         Yii::$app->session->get('cart')->remove($product, $quantity);
         $result = Yii::$app->session->get('cart')->totalValue();
         $result = I18n::currency($result);
     }
     return $result;
 }
Ejemplo n.º 2
0
    ?>
</td>
            </tr>
            <?php 
    $total_value += $item->quantity * $item->unit_price;
}
?>
        </tbody>
        <tfoot style="background:#fff">
            <tr>
                <td colspan="2"><?php 
echo I18n::t('Total amount');
?>
</td>
                <td colspan="2"><strong><?php 
echo I18n::currency($total_value);
?>
</strong></td>
            </tr>
        </tfoot>
    </table>
    <p><?php 
echo I18n::t('Thank you for your purchase');
?>
</p>
    <p><?php 
echo Html::a(Html::encode($homeLink), $homeLink);
?>
</p>
    <p><?php 
echo I18n::t('{email signature}');
Ejemplo n.º 3
0
use yii\web\View;
use yii\widgets\DetailView;
/* @var $this View */
/* @var $model PurchaseOrderDetail */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Purchase Order Details', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="purchase-order-detail-view">

    <!--<h1><?php 
echo Html::encode($this->title);
?>
</h1>-->

    <p class="pull-right">
        <?php 
echo Html::a('<span class="fa fa-edit"></span> Ghi chú', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
   <!-- <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
 -->
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['product_name', 'product_code', ['attribute' => 'unit_price', 'value' => I18n::currency($model->unit_price)], 'quantity', 'customer_note', 'user_note']]);
?>

</div>
Ejemplo n.º 4
0
    <?php 
if (count($cart->data) > 0) {
    ?>
        <h1><?php 
    echo I18n::t('Your cart');
    ?>
</h1>
        <!--<form id="orderForm" method="POST" action="<?php 
    echo Url::to(['purchase-order/index']);
    ?>
">-->
        <form id="orderForm">
            <fieldset>
                <table>
                    <?php 
    $totalValue = I18n::currency($cart->totalValue());
    foreach ($cart->data as $item) {
        $p = $item['product'];
        $qty = $item['quantity'];
        ?>
                        <tr class="tr_product">
                            <td class="td_product_img">
                                <img src="<?php 
        echo $p->getImage(Product::$image_resizes['small'], true);
        ?>
"> 
                            </td>
                            <td class="td_product_name">
                                <a href="<?php 
        echo $p->getLink();
        ?>
Ejemplo n.º 5
0
 public function currency($column)
 {
     return \common\models\I18n::currency($this->{$column});
 }
Ejemplo n.º 6
0
$this->title = 'Purchase Order Details';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="purchase-order-detail-index">

<!--    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
    <?php 
echo Html::a('Create Purchase Order Detail', ['create'], ['class' => 'btn btn-success']);
?>
    </p>-->

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'product_name', 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->product_name, ['product/update', 'id' => $model->product_id], []);
}], 'product_code', ['attribute' => 'unit_price', 'format' => 'raw', 'value' => function ($model) {
    return I18n::currency($model->unit_price);
}], 'quantity', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<button class="btn btn-default btn-sm glyphicon glyphicon-eye-open"></button>', $url);
}]]]]);
?>

</div>
Ejemplo n.º 7
0
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\DetailView;
/* @var $this View */
/* @var $searchModel CustomerSearch */
/* @var $dataProvider ActiveDataProvider */
$this->title = $model->username;
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="customer-index form_container">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <br>
    <?php 
echo Html::a(I18n::t('Update'), ['customer/update', 'username' => $model->username], ['class' => 'submit_bt']);
?>
    <?php 
echo Html::a(I18n::t('Logout'), ['site/logout'], ['class' => 'submit_bt', 'style' => 'background:#ddd']);
?>
    <br>
    <br>
    <?php 
echo DetailView::widget(['model' => $model, 'options' => ['style' => 'text-align:left'], 'attributes' => ['username', 'firstname', 'lastname', 'email:email', 'phone_number', 'address', ['attribute' => 'dob', 'value' => date('d-m-Y', $model->dob)], ['attribute' => 'gender', 'value' => $model->gender === 1 ? I18n::t('Male') : ($model->gender === 2 ? I18n::t('Female') : I18n::t('Other'))], ['attribute' => 'created_at', 'value' => date('d-m-Y H:i', $model->created_at)], ['attribute' => 'updated_at', 'value' => date('d-m-Y H:i', $model->created_at)], 'total_purchase_orders', 'total_purchase_products', 'total_purchase_value', ['attribute' => 'total_purchase_value', 'value' => I18n::currency($model->total_purchase_value)]]]);
?>
    
</div>