コード例 #1
0
 public function getProductsInPurchases()
 {
     $filter = \Input::get('filter', []);
     $search_query = '';
     $category_id = 0;
     if (array_key_exists('query', $filter)) {
         $search_query = trim($filter['query']);
     }
     if (array_key_exists('category', $filter)) {
         $category_id = intval($filter['category']);
     }
     $matches_ids = [];
     if ($category_id) {
         $products_ids_arr = \App\Helpers\ProjectHelper::getProductsIdsArrByTagId($category_id);
         $matches_ids = array_merge($matches_ids, $products_ids_arr);
     }
     if ($search_query) {
         $sphinx = \Sphinx\SphinxClient::create();
         $sphinx->setServer('127.0.0.1', 3312);
         $sphinx->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_ANY);
         $sphinx->setSortMode(\Sphinx\SphinxClient::SPH_SORT_RELEVANCE);
         $sphinx->setFieldWeights(array('name' => 20, 'description' => 10));
         $sphinx->addQuery($search_query, '*');
         $res = $sphinx->runQueries();
         if (!$res or !array_key_exists('matches', $res[0])) {
             return [];
         }
         $matches_ids = array_merge($matches_ids, array_keys($res[0]['matches']));
     }
     $products_in_purchases_query = \DB::table('products_in_purchase')->select('*');
     if (!empty($matches_ids)) {
         $products_in_purchases_query = $products_in_purchases_query->whereIn('product_id', $matches_ids);
     }
     $products_in_purchases_arr = $products_in_purchases_query->take(12)->get();
     if (empty($products_in_purchases_arr)) {
         return [];
     }
     $products_arr = [];
     foreach ($products_in_purchases_arr as $product_in_purchase_mix) {
         $product = \App\BusinessLogic\Models\Product::find($product_in_purchase_mix->product_id);
         $purchase = \App\BusinessLogic\Models\Purchase::find($product_in_purchase_mix->purchase_id);
         $products_arr[] = new ProductInPurchase($product, $purchase);
     }
     return $products_arr;
 }
コード例 #2
0
@extends('seller.layout')

@section('content')

<?php 
$project_id = 1;
$project = \App\Models\ProjectModel::find($project_id);
$categories_models = \App\Helpers\ProjectHelper::getCategoriesByProjectId($project_id);
$attributes_group_id = \App\Helpers\ProjectHelper::getDefaultAttributesGroupId();
$attributes = \App\Models\AttributeModel::where('attribute_group_id', '=', $attributes_group_id)->get();
?>

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <?php 
$supplier_id = \Input::get('supplier_id');
$supplier_model = null;
if ($supplier_id) {
    $supplier_model = $user->suppliers()->find($supplier_id);
    \App\Helpers\Assistant::assertModel($supplier_model);
}
?>

            <div class="btn-toolbar" role="toolbar" style="padding: 10px 0;">
                <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#editProduct">
                    Добавить товар
                </button>
            </div>

            <table class="table table-condensed table-striped table-hover table-bordered">
コード例 #3
0
ファイル: index.php プロジェクト: NikDevPHP/yii2-test-job
                            <?php 
        echo ProjectHelper::getStatus($model->status);
        ?>
                            <div class="list-group-item clearfix">
                                <h4 class="list-group-item-heading"><?php 
        echo ProjectHelper::getName($model->name);
        ?>
</h4>
                                <p class="list-group-item-text"><?php 
        echo ProjectHelper::getDescription($model->description);
        ?>
</p>
                                <br/>
                                <p class="list-group-item-text">
                                    <span class="text-primary pull-left"><?php 
        echo ProjectHelper::getPositions($model->node);
        ?>
</span>
                                    <a href="<?php 
        echo Url::toRoute(['/project/update', 'id' => $model->id]);
        ?>
" class="pull-right">Редактировать проект</a>
                                </p>
                            </div>
                        </div>
                    <?php 
    }
    ?>
                <?php 
} else {
    ?>
コード例 #4
0
@extends('seller.layout')

@section('content')
    <?php 
$attributes_groups = \App\Helpers\ProjectHelper::getAttributesGroups();
?>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">Группы атрибутов</div>
                    <div class="panel-body">
                        <div class="btn-group btn-group-sm">
                            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#editAttributesGroup">
                                Добавить группу атрибутов
                            </button>
                        </div>
                    </div>

                    <div class="">
                        <table class="table table-condensed table-striped table-hover" style="border-bottom: 1px solid #DDD; border-top: 1px solid #DDD">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>Наименование группы</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach ($attributes_groups as $attributes_group)
                                <tr>
                                    <td>{{ $attributes_group->id }}</td>
コード例 #5
0
ファイル: index.php プロジェクト: NikDevPHP/yii2-test-job
                            <?php 
        echo ProjectHelper::getStatus($model->status);
        ?>
                            <div class="list-group-item clearfix">
                                <h4 class="list-group-item-heading"><?php 
        echo ProjectHelper::getName($model->name);
        ?>
</h4>
                                <p class="list-group-item-text"><?php 
        echo ProjectHelper::getDescription($model->description);
        ?>
</p>
                                <br/>
                                <p class="list-group-item-text">
                                    <small class="text-primary pull-left"><?php 
        echo ProjectHelper::getPositions([]);
        ?>
</small>
                                    <a href="<?php 
        echo Url::toRoute(['/project/update', 'id' => $model->id]);
        ?>
" class="pull-right">Редактировать проект</a>
                                </p>
                            </div>
                        </div>
                    <?php 
    }
    ?>

                    <?php 
    echo LinkPager::widget(['pagination' => $dataProvider->pagination]);
コード例 #6
0
@extends('seller.layout')

@section('content')
    <?php 
$attributes = \App\Helpers\ProjectHelper::getAttributesByGroupId($id);
?>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">Атрибуты группы: <strong>{{ $name }}</strong></div>
                    <div class="panel-body">
                        <div class="btn-group btn-group-sm">
                            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#editAttribute">
                                Добавить атрибут
                            </button>
                        </div>
                    </div>

                    <div class="">
                        <table class="table table-condensed table-striped table-hover" style="border-bottom: 1px solid #DDD; border-top: 1px solid #DDD">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>Наименование атрибута</th>
                                <th>Уникальное имя</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach ($attributes as $attribute)
                                <tr>