コード例 #1
0
 /**
  * Finds the Subcategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Subcategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Subcategory::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: aiskimzhi/rep
 public function actionGetSubcat($id)
 {
     $countSubcats = Subcategory::find()->where(['category_id' => $id])->count();
     $subcats = Subcategory::find()->where(['category_id' => $id])->orderBy('id ASC')->all();
     if ($countSubcats > 0) {
         foreach ($subcats as $subcat) {
             echo "<option value='" . $subcat->id . "'>" . $subcat->name . "</option>";
         }
     } else {
         echo "<option>-</option>";
     }
     //        echo Json::encode(['output'=>'', 'selected'=>'']);
 }
コード例 #3
0
ファイル: SubcategorySearch.php プロジェクト: shahid80/EWay
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Subcategory::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $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, 'category_id' => $this->category_id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
コード例 #4
0
ファイル: Category.php プロジェクト: frankpaul142/mosaico
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSubcategories()
 {
     return $this->hasMany(Subcategory::className(), ['category_id' => 'id'])->where('status="ACTIVE"');
 }
コード例 #5
0
ファイル: _search.php プロジェクト: shahid80/EWay
                <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
                    Search
                </a>
            </h4>
        </div>
        <div id="collapseOne" class="panel-collapse collapse">
            <div class="panel-body">
                <div class="ad-search">

                    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>
                    
                    <div class="col-sm-4 col-md-4 col-lg-4">
                        <?php 
echo $form->field($model, 'subcategory_id')->label('Subcategory')->dropDownList(['' => ''] + Subcategory::getList());
?>

                        <?php 
echo $form->field($model, 'user_id')->label('User')->dropDownList(['' => ''] + User::getList());
?>
                        
                        <?php 
echo $form->field($model, 'location_id')->label('Location')->dropDownList(['' => ''] + Location::getList());
?>

                        <?php 
echo $form->field($model, 'title');
?>

                        <?php 
コード例 #6
0
ファイル: Product.php プロジェクト: frankpaul142/mosaico
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSubcategory()
 {
     return $this->hasOne(Subcategory::className(), ['id' => 'subcategory_id']);
 }
コード例 #7
0
ファイル: Category.php プロジェクト: aiskimzhi/advert
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSubcategories()
 {
     return $this->hasMany(Subcategory::className(), ['category_id' => 'id']);
 }
コード例 #8
0
ファイル: _form.php プロジェクト: frankpaul142/mosaico
});
JS;
$this->registerJs($script, View::POS_END);
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
    <?php 
echo $form->field($model, 'auction')->dropDownList(['YES' => 'SI', 'NO' => 'NO'], ['prompt' => '¿Producto como subasta?']);
?>

    <?php 
echo $form->field($model, 'subcategory_id')->DropDownList(ArrayHelper::map(Subcategory::find()->all(), 'id', 'name'), ['prompt' => 'Selecciona una subcategoría.']);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 150]);
?>

    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'stock')->textInput();
?>

    <?php 
コード例 #9
0
ファイル: _form.php プロジェクト: shahid80/EWay
echo $form->field($model, 'title')->label(false)->textInput(['maxlength' => true, 'class' => 'submitInput']);
?>
                    </div>
                    <div class="labelDiv">
                    <label>Price*</label><?php 
echo $form->field($model, 'price')->label(false)->textInput(['maxlength' => true, 'class' => 'submitInput']);
?>
                    </div>
                    <div class="refineHeadingSpan">
                         <span>Category*</span>
                    </div>
                    <div id="sortContainer">
                                    <div tabindex="0" class="onclick-menu">
                                        <ul class="onclick-menu-content">
                                            <?php 
$subCategories = Subcategory::getList();
?>
                                            <?php 
foreach ($subCategories as $id => $title) {
    ?>
                                            <li data-field="ad-subcategory_id" data-id="<?php 
    echo $id;
    ?>
"><?php 
    echo $title;
    ?>
</li></a>
                                            <?php 
}
?>
                                        </ul>