Example #1
0
use yii\helpers\ArrayHelper;
use app\models\ProductGroup;

/* @var $this yii\web\View */
/* @var $searchModel app\models\search\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Products');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">

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

    <?php app\components\Util::createButton(); ?>
    
    <?=
    GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'code',
            'name',
            [
                'attribute' => 'product_group_id',
                'value' => function($data) {
                    return $data->getProductGroup()->one()->name;
                },
                'filter' => Html::activeDropDownList($searchModel, 'product_group_id', ArrayHelper::map(ProductGroup::find()->asArray()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => Yii::t('app', 'All')]),
Example #2
0
                <ul class="products-list product-list-in-box">
                    
                    <?php 
if ($recents) {
    foreach ($recents as $recent) {
        ?>
                    <li class="item">
                        <div class="product-img">
                            09:10
                        </div>
                        <div class="product-info">
                            <a href="javascript::;" class="product-title"><?php 
        echo $recent->po;
        ?>
 <span class="label label-warning pull-right"><?php 
        echo app\components\Util::Rp($recent->total);
        ?>
</span></a>
                            <span class="product-description">
                                <?php 
        echo $recent->shipping->address;
        ?>
                            </span>
                        </div>
                    </li><!-- /.item -->
                    <?php 
    }
}
?>