Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DeliveryMethods::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(['delivery_method_id' => $this->delivery_method_id, 'delivery_method_price' => $this->delivery_method_price, 'date_added' => $this->date_added, 'date_modified' => $this->date_modified, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'delivery_method_name', $this->delivery_method_name]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDeliveryMethod()
 {
     return $this->hasOne(DeliveryMethods::className(), ['delivery_method_id' => 'delivery_method_id']);
 }
Пример #3
0
 /**
  * Finds the DeliveryMethods model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return DeliveryMethods the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DeliveryMethods::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
            <?php 
/* @var $form ActiveForm */
$form = ActiveForm::begin(['id' => 'order-form']);
?>

             <?php 
echo $form->field($order, 'phone');
?>
             <?php 
echo $form->field($order, 'email');
?>
             <?php 
echo $form->field($order, 'notes')->textarea();
?>
             <?php 
echo $form->field($order, 'delivery_method_id')->dropDownList(ArrayHelper::map(DeliveryMethods::find()->all(), 'delivery_method_id', 'delivery_method_name'));
?>
        </div>
        <div class="form-group row">
            <div class="col-xs-12">
                <?php 
echo Html::submitButton('Order', ['class' => 'btn btn-primary']);
?>
            </div>
        </div>

        <?php 
ActiveForm::end();
?>
    </div>
</div>