示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Catalog::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'operation_id' => $this->operation_id, 'user_id' => $this->user_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Catalog::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'year' => $this->year, 'price' => $this->price, 'sale' => $this->sale, 'sold' => $this->sold]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'author', $this->author])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'img', $this->img])->andFilterWhere(['like', 'category', $this->category]);
     return $dataProvider;
 }
 /**
  * Creates a new Catalog model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Catalog();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // data catalog
         $data_catalog = $_POST['Catalog'];
         // name catalog
         foreach ($data_catalog as $vlCatalog) {
             $name_catalog = $vlCatalog;
         }
         // last id catalog
         $last_catalog = Catalog::find()->orderBy('id_catalog DESC')->one();
         $last = $last_catalog->id_catalog;
         // insert search_table
         $search_catalog = new SearchTable(['name_search' => $name_catalog, 'type_search' => '1', 'link_search' => $last]);
         $search_catalog->save();
         return $this->redirect(['view', 'id' => $model->id_catalog]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
示例#4
0
?>

<p>
    <button class="btn btn-link">
        <span class="glyphicon glyphicon-menu-hamburger"></span> Отобразить информацию о всех товарах
    </button>
    <a href="/deferred" class="btn btn-default">Отложенные товары</a>
    <a href="/history" class="btn btn-default">История заказов</a>
    <a href="/history" class="btn btn-primary" title="Список оплаченных заказов, ожидающих доставки" data-toggle="tooltip" data-placement="right">
        Мои заказы, ожидающие доставки
    </a>
</p>

@foreach($open_orders_catalogs_ids_arr as $open_orders_catalog_id)
    <?php 
$catalog_model = \App\Models\Catalog::find($open_orders_catalog_id);
$deferred_products = $user->deferredProducts($open_orders_catalog_id)->get();
?>
    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row">
                <div class="col-lg-9">
                    <strong>Название закупки</strong>
                    <a href="#" class="glyphicon glyphicon-link"></a>
                </div>
                <div class="col-lg-3 text-right">
                    @if( count($deferred_products) > 0 )
                        <a href="#"><span class="glyphicon glyphicon-eye-close" style="padding-right: 5px"></span> <strong>{{ count($deferred_products) }} отложенных товаров</strong></a>
                    @endif
                </div>
            </div>
 /**
  * selection product
  */
 public function actionSelection()
 {
     $model = new ContactForm();
     $arr_catalog = Catalog::find()->all();
     foreach ($arr_catalog as $vlCatalog) {
         $id[] = $vlCatalog->id_catalog;
         $name[] = $vlCatalog->catalog_name;
     }
     $catalog = array_combine($id, $name);
     return $this->render('selection', ['model' => $model, 'catalog' => $catalog]);
 }
示例#6
0
</td>
                <td><?php 
    echo $item->Cost;
    ?>
</td>
                <td><?php 
    echo $item->Number;
    ?>
</td>
                <td><?php 
    echo Html::a('Добавить в корзину', ['/site/add', 'addid' => $item->Item_Id], ['class' => 'btn btn-primary']);
    ?>
</td>
            </tr>
        <?php 
}
?>
    </tbody>
</table>

<?php 
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use app\models\Catalog;
use yii\grid\CheckboxColumn;
use yii\grid\SerialColumn;
use yii\grid\DataColumn;
$dataProvider = new ActiveDataProvider(['query' => Catalog::find(), 'pagination' => ['pageSize' => 20]]);
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['Name', 'Description', 'Cost', 'Number', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{link}', 'buttons' => ['link' => function ($url, $Index, $key) {
    return Html::a('Добавить в корзину', ['/site/add', 'addid' => $Index->Item_Id]);
}]]]]);
示例#7
0
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Catalog;
/* @var $this yii\web\View */
/* @var $model app\models\Section */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="section-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'catalog_id')->label('Каталог')->dropDownList(ArrayHelper::map(Catalog::find()->all(), 'id_catalog', 'catalog_name'), ['prompt' => 'Выберите значение']);
?>

    <?php 
echo $form->field($model, 'section_name')->label('Раздел')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'section_photo')->label('Фото')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'id_section')->label('')->hiddenInput(['maxlength' => true]);
?>

    <div class="form-group">