/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Brandsmaster::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->joinWith('createdBy0','updatedBy0'); // $query->joinWith('updatedBy0'); $query->andFilterWhere(['brandId' => $this->brandId, 'createdDate' => $this->createdDate, 'updatedDate' => $this->updatedDate]); $query->andFilterWhere(['like', 'brandName', $this->brandName])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'ipAddress', $this->ipAddress]); return $dataProvider; }
<tr> <td><?php echo $key; ?> </td> <td id="productId<?php echo $model['Saleid']; ?> " contentEditable="true"><?php echo $model['productId']; ?> </td> <td contentEditable="true"><?php echo Html::activeDropDownList($model, 'Brand', ArrayHelper::map(Brandsmaster::find()->all(), 'brandName', 'brandName'), ['id' => 'brand' . $model['Saleid']]); ?> </td> <td contentEditable="true"><?php echo Html::activeDropDownList($model, 'categoryName', ArrayHelper::map(Categories::find()->all(), 'categoryName', 'categoryName'), ['id' => 'categoryId' . $model['Saleid']]); ?> </td> <td id="quntity<?php echo $model['Saleid']; ?> " contentEditable="true"><?php echo $model['Quantity']; ?> </td> <td id="uom<?php echo $model['Saleid'];
</div> <?php $form = ActiveForm::begin(['method' => 'get']); ?> <div class="col-md-3"> <div id="imaginary_container"> <div class="input-group stylish-input-group"> <?php echo $form->field($searchModel, 'productId')->textInput(array('placeholder' => 'Product code'))->label(false); ?> </div> </div> </div> <div class="col-md-3"> <?php echo $form->field($searchModel, 'Brand')->dropDownList(ArrayHelper::map(Brandsmaster::find()->all(), 'brandName', 'brandName'), ['prompt' => 'Select Brand'])->label(false); ?> </div> <div class="col-md-3"> <?php echo $form->field($searchModel, 'categoryName')->dropDownList(ArrayHelper::map(Categories::find()->all(), 'categoryName', 'categoryName'), ['prompt' => 'Select Category'])->label(false); ?> </div> <?php ActiveForm::end(); ?> </div> <div class="row"> <div class="col-md-12"> <div class="student-form">
?> ">Product Name</label> <?php echo Html::activeDropDownList($model, 'productId', ArrayHelper::map(Products::find()->all(), 'productCode', 'productName'), ['prompt' => 'Select Product', 'class' => 'form-control', 'id' => 'vendorproducts-productid' . $cnt]); ?> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="control-label" for="vendorproducts-brand<?php echo $cnt; ?> ">Brand</label> <?php echo Html::activeDropDownList($model, 'Brand', ArrayHelper::map(Brandsmaster::find()->all(), 'brandName', 'brandName'), ['prompt' => 'Select Brand', 'class' => 'form-control', 'id' => 'vendorproducts-brand' . $cnt]); ?> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="control-label" for="vendorproducts-categoryname<?php echo $cnt; ?> ">Category Name</label> <?php echo Html::activeDropDownList($model, 'categoryName', ArrayHelper::map(Categories::find()->all(), 'categoryName', 'categoryName'), ['prompt' => 'Select categoryName', 'class' => 'form-control', 'id' => 'vendorproducts-categoryname' . $cnt]); ?> </div> </div>
/* @var $form yii\widgets\ActiveForm */ ?> <div class="products-brands-form"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'productId')->dropDownList(ArrayHelper::map(Products::find()->all(), 'id', 'productName'), ['prompt' => 'Select Product']); ?> <?php echo $form->field($model, 'brandId')->dropDownList(ArrayHelper::map(Brandsmaster::find()->all(), 'brandId', 'brandName'), ['prompt' => 'Select Brand']); ?> <?php echo $form->field($model, 'file')->fileInput(); ?> <?php echo $form->field($model, 'productupdateImage')->hiddenInput(['value' => $model->productImage]); ?> <?php if ($model->productImage != '') { ?> <img src='<?php echo $model->productImage; ?> ' width="150px" height="50px;" style="margin-top:-80px;">
public static function getBrandId($name) { $brandsInfo = Brandsmaster::find()->select('brandId')->where(['brandName' => $name])->one(); return $brandsInfo; }