コード例 #1
0
ファイル: products_list.php プロジェクト: pistol88/yii2-order
.pistol88-change-count, .pistol88-cart-buy-button {
    display: inline;
    width: 45%;
}

.products-list select {
    padding: 1px;
    margin: 1px;
    font-size: 12px;
    height: auto;
}
</style>
<div class="products-list">

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => ['style' => 'width: 45px;']], ['attribute' => 'name', 'content' => function ($product) {
    $name = Html::tag('div', $product->name, ['style' => 'clear: both;']);
    $count = ChangeCount::widget(['model' => $product->sellModel]);
    if ($product->getCartOptions()) {
        $options = ChangeOptions::widget(['model' => $product]);
    } else {
        $options = null;
    }
    $btn = BuyButton::widget(['model' => $product->sellModel, 'text' => yii::t('order', 'To order'), 'htmlTag' => 'a', 'cssClass' => 'btn btn-success to-order']);
    return Html::tag('div', $name . $options . $count . $btn, ['class' => 'pistol88-order-prodlist-widgets']);
}], 'code', ['attribute' => 'category_id', 'filter' => Html::activeDropDownList($searchModel, 'category_id', $categories, ['class' => 'form-control', 'prompt' => 'Категория']), 'value' => 'category.name'], ['label' => yii::t('order', 'Amount'), 'value' => 'amount'], ['label' => yii::t('order', 'Price'), 'value' => 'price']]]);
?>
    
</div>
コード例 #2
0
ファイル: index.php プロジェクト: pistol88/yii2-cart
?>
</h1>
    <?php 
foreach ($elements as $element) {
    ?>
        <div class="row">
            <div class="col-lg-6 col-xs-6">
                <strong><?php 
    echo $element->getModel()->getCartName();
    ?>
 (<?php 
    echo $element->getModel()->getCartPrice();
    ?>
 р.)</strong>
                <?php 
    echo ChangeOptions::widget(['model' => $element, 'type' => 'radio']);
    ?>
            </div>
            <div class="col-lg-4 col-xs-4">
                <?php 
    echo ChangeCount::widget(['model' => $element]);
    ?>
            </div>
            <div class="col-lg-2 col-xs-2">
                <?php 
    echo DeleteButton::widget(['model' => $element, 'lineSelector' => '.row']);
    ?>
            </div>
        </div>
    <?php 
}