public function actionAdmin() { $model = new Order('search'); $model->unsetAttributes(); if (isset($_GET['Order'])) { $model->setAttributes($_GET['Order']); } $this->render('admin', array('model' => $model)); }
public function actionIndex() { $model = new Order('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getQuery('Order')) { $model->setAttributes(Yii::app()->getRequest()->getQuery('Order')); } $this->render('index', ['model' => $model]); }
public function actionCreate() { $model = new Order(); $description = new OrderDescription(); //$order_option_value = new OrderOptionValue; $this->performAjaxValidation(array($model, $description), 'order-form'); if (isset($_POST[$this->modelName])) { $model->setAttributes($_POST[$this->modelName]); $description->setAttributes($_POST[$this->modelName . 'Description']); $suc = Yii::t('info', 'Order was successfully created'); $err = Yii::t('info', 'Could not create Order'); $description->order_id = 0; $description->locale_code = Yii::app()->getLanguage(); if ($this->validateOrder($model, $description)) { if ($model->save()) { $description->order_id = $model->id; $description->save(); $this->orderSave($model); Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc); if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_view', array('model' => $model, 'description' => $description, 'customer' => $this->_ordercustomer, 'orderProduct' => $this->_orderproduct), false, true); Yii::app()->end(); } else { $this->redirect(array('view', 'id' => $model->id)); } } else { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err); } } } if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_form_order', array('model' => $model, 'description' => $description, 'customer' => $this->_ordercustomer, 'orderproduct' => $this->_orderproduct), false, true); Yii::app()->end(); } $this->render('create', array('model' => $model, 'description' => $description, 'customer' => $this->_ordercustomer, 'orderproduct' => $this->_orderproduct)); }
/** * Ajax action. Get list of Supplier Addresses. * * @throws CHttpException */ public function actionGetLoadingAddressList() { if (Yii::app()->request->isPostRequest) { $order = new Order(); $order->setAttributes($_POST['Order']); $supplierAddressesList = SupplierAddresses::getListBySupplierId($order->supplier_id); foreach ($supplierAddressesList as $value => $name) { echo CHtml::tag('option', ['value' => $value], CHtml::encode($name)); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } Yii::app()->end(); }
public function actionRefreshDetails() { $model = new Order(); $description = new OrderDescription(); $sess = Yii::app()->user->getState('order_product'); $model->setAttributes($_POST[$this->modelName]); $description->setAttributes($_POST[$this->modelName . 'Description']); $this->renderPartial('_details', array('orderproduct' => $sess, 'model' => $model, 'description' => $description), false, true); Yii::app()->end(); }