Esempio n. 1
0
 /**
  * Категория с товарами
  *
  * @param $category string id_string
  * @param $id int идентификатор объединения
  * @param $shop_category int идентификатор категории gs_unions_shop_tree.id
  *
  * @return string
  * @throws \cs\web\Exception
  */
 public function actionCategory($category, $id, $shop_category)
 {
     $item = Union::find($id);
     if (is_null($item)) {
         throw new Exception('Нет такого объединения');
     }
     $categoryObject = UnionCategory::find(['id_string' => $category]);
     if (is_null($categoryObject)) {
         throw new Exception('Не найдена категория');
     }
     $treeNode = TreeNode::find($shop_category);
     $breadcrumbs = $categoryObject->getBreadCrumbs();
     $breadcrumbs = ArrayHelper::merge($breadcrumbs, [['url' => ['page/union_item', 'id' => $item->getId(), 'category' => $categoryObject->getField('id_string')], 'label' => $item->getName()], ['url' => ['union_shop/index', 'id' => $item->getId(), 'category' => $categoryObject->getField('id_string')], 'label' => 'Магазин'], $treeNode->getField('name')]);
     return $this->render(['union' => $item, 'shop' => $item->getShop(), 'breadcrumbs' => $breadcrumbs, 'category' => $categoryObject, 'items' => Product::query(['moderation_status' => 1, 'tree_node_id' => $treeNode->getId()])->orderBy(['sort_index' => SORT_ASC])->all()]);
 }
Esempio n. 2
0
<div class="container">

    <div class="col-lg-12">
        <h1 class="page-header"><?php 
echo \yii\helpers\Html::encode($this->title);
?>
</h1>
    </div>


    <div class="col-lg-12">
        <input type="text" class="form-control" size="20"/>
    </div>

    <?php 
$shopList = \app\models\Shop\Product::query()->groupBy('gs_unions_shop.id')->innerJoin('gs_unions_shop_tree', 'gs_unions_shop_tree.id = gs_unions_shop_product.tree_node_id')->innerJoin('gs_unions_shop', 'gs_unions_shop.id = gs_unions_shop_tree.shop_id')->select(['gs_unions_shop.*'])->all();
?>
    <?php 
foreach ($shopList as $i) {
    ?>
        <p><?php 
    echo $shopList['name'];
    ?>
</p>
    <?php 
}
?>

    <div class="col-lg-12">
        <hr>
        <?php 
Esempio n. 3
0
            <h1><?php 
echo Html::encode($this->title);
?>
</h1>
        </div>



        <?php 
$ids = [];
foreach (\app\modules\Shop\services\Basket::get() as $item) {
    $ids[] = $item['id'];
}
$unionRows = \app\models\Shop\Product::query(['in', 'gs_unions_shop_product.id', $ids])->innerJoin('gs_unions', 'gs_unions.id = gs_unions_shop_product.union_id')->select(['gs_unions.*'])->groupBy(['gs_unions_shop_product.union_id'])->all();
for ($i = 0; $i < count($unionRows); $i++) {
    $unionRows[$i]['productList'] = \app\models\Shop\Product::query(['union_id' => $unionRows[$i]['id']])->andWhere(['in', 'gs_unions_shop_product.id', $ids])->all();
    for ($j = 0; $j < count($unionRows[$i]['productList']); $j++) {
        foreach (\app\modules\Shop\services\Basket::get() as $d) {
            if ($unionRows[$i]['productList'][$j]['id'] == $d['id']) {
                $unionRows[$i]['productList'][$j]['count'] = $d['count'];
                continue;
            }
        }
    }
}
?>

        <table class="table table-striped table-hover">
            <tr>
                <th>
                    #
Esempio n. 4
0
use app\models\UnionCategory;
/* @var $this yii\web\View */
/* @var $union_id int */
$this->title = 'Товары';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container">
    <div class="page-header">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>

    <?php 
echo \yii\grid\GridView::widget(['tableOptions' => ['class' => 'table tableMy table-striped table-hover'], 'dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\Shop\Product::query(['union_id' => $union_id])->select(['id', 'name', 'image'])->orderBy(['sort_index' => SORT_ASC]), 'pagination' => ['pageSize' => 50]]), 'columns' => ['id', ['header' => 'Картинка', 'content' => function ($item) {
    $i = \yii\helpers\ArrayHelper::getValue($item, 'image', '');
    if ($i == '') {
        return '';
    }
    return Html::img($i, ['width' => 100]);
}], 'name', ['header' => 'Редактировать', 'content' => function ($item) {
    return Html::a('Редактировать', ['cabinet_shop/product_list_edit', 'id' => $item['id']], ['class' => 'btn btn-primary']);
}]]]);
?>
    <hr>
    <a href="<?php 
echo \yii\helpers\Url::to(['cabinet_shop/product_list_add', 'id' => $union_id]);
?>
" class="btn btn-default">Добавить</a>
</div>
Esempio n. 5
0
/* @var $this yii\web\View */
/* @var $list array */
/* @var $pagesCount int */
/* @var $page int */
$this->title = 'Наши подарки';
?>

<!-- About Section -->
<section id="about" class="container content-section" style="margin-top: 50px;">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2">
            <h2 class="text-center">Наши подарки</h2>
            <p>Мы предлагаем вам всевозможные варианты сотрудничества с нами. Выберите наиболее подходящий для вас и получите его.</p>

            <?php 
$all = \app\models\Shop\Product::query()->orderBy(['price' => SORT_ASC])->all();
for ($i = 0; $i < count($all); $i++) {
    $item =& $all[$i];
    ?>
                <div class="row">
                    <div class="col-lg-4">
                        <p><img src="<?php 
    echo $item['image'];
    ?>
" width="100%" style="border-radius: 10px;"></p>
                    </div>
                    <div class="col-lg-8">
                        <p><b><?php 
    echo $item['name'];
    ?>
</b></p>
Esempio n. 6
0
    \$('.rowTable').click(function() {
        window.location = '/admin/products/' + \$(this).data('id');
    });


JS
);
?>

<div class="container">
    <h1 class="page-header">Продукты</h1>


    <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\Shop\Product::query()->orderBy(['price' => SORT_ASC]), 'pagination' => ['pageSize' => 20]]), 'tableOptions' => ['class' => 'table table-hover table-striped'], 'rowOptions' => function ($item) {
    return ['role' => 'button', 'data-id' => $item['id'], 'class' => 'rowTable'];
}, 'columns' => ['id', ['header' => 'Картинка', 'content' => function ($item) {
    if (\yii\helpers\ArrayHelper::getValue($item, 'image', '') == '') {
        return '';
    }
    return Html::img($item['image'], ['width' => 50, 'class' => 'thumbnail', 'style' => 'margin-bottom: 0px;']);
}], 'name', 'price', ['header' => 'Удалить', 'content' => function ($item) {
    return Html::button('Удалить', ['class' => 'btn btn-danger btn-xs buttonDelete', 'data-id' => $item['id']]);
}]]]);
?>


    <div class="col-lg-6">
        <div class="row">
            <!-- Split button -->