Exemple #1
0
 private function _row($item)
 {
     if (is_string($item)) {
         return html::tag('li', $item);
     }
     $columns = [];
     $product = $item->getModel();
     $allOptions = $product->getCartOptions();
     $cartElName = $product->getCartName();
     if ($this->showOptions && $item->getOptions()) {
         $options = '';
         foreach ($item->getOptions() as $optionId => $valueId) {
             if ($optionData = $allOptions[$optionId]) {
                 $option = $optionData['name'];
                 $value = $optionData['variants'][$valueId];
                 $options .= Html::tag('div', Html::tag('strong', $option) . ':' . $value);
             }
         }
         $cartElName .= Html::tag('div', $options, ['class' => 'pistol88-cart-show-options']);
     }
     if (!empty($this->otherFields)) {
         foreach ($this->otherFields as $fieldName => $field) {
             $cartElName .= Html::tag('p', Html::tag('small', $fieldName . ': ' . $product->{$field}));
         }
     }
     if ($this->columns == 4) {
         $columns[] = Html::tag('div', $cartElName, ['class' => 'col-lg-6 col-md-6 col-xs-6']);
         $columns[] = Html::tag('div', ChangeCount::widget(['model' => $item, 'showArrows' => $this->showCountArrows]), ['class' => 'col-lg-3 col-xs-3']);
         $columns[] = Html::tag('div', $this->_getCostFormatted($item->getCost(false)), ['class' => 'col-lg-2 col-xs-2']);
     } else {
         $columns[] = Html::tag('div', $cartElName, ['class' => 'col-lg-8 col-md-8 col-xs-8']);
         $columns[] = Html::tag('div', $this->_getCostFormatted($item->getCost(false)) . ChangeCount::widget(['model' => $item, 'showArrows' => $this->showCountArrows]), ['class' => 'col-lg-3 col-md-3 col-xs-3']);
     }
     $columns[] = Html::tag('div', DeleteButton::widget(['model' => $item, 'lineSelector' => 'pistol88-cart-row ', 'cssClass' => 'delete']), ['class' => 'shop-cart-delete col-lg-1 col-md-1 col-xs-1']);
     $return = html::tag('div', implode('', $columns), ['class' => ' row']);
     return Html::tag('li', $return, ['class' => 'pistol88-cart-row ']);
 }
.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>
Exemple #3
0
        <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 
}
?>
    <div class="total">
        <?php 
echo CartInformer::widget(['htmlTag' => 'h3']);
?>