public function sendEmailToUsers() { $view = 'notification'; $mailer = Yii::$app->mailer; $mailer->viewPath = '@sap55/order/views/mail'; $mailer->getView()->theme = \Yii::$app->view->theme; $store = Store::findOne($this->store_id); $emails = ArrayHelper::getColumn($store->users, 'email'); if (($key = array_search(Yii::$app->user->identity->email, $emails)) !== false) { unset($emails[$key]); } // Yii::info(print_r($emails)); $mailer->compose(['html' => $view, 'text' => 'text/' . $view], ['order' => $this])->setFrom(isset(\Yii::$app->params['adminEmail']) ? \Yii::$app->params['adminEmail'] : '*****@*****.**')->setTo($emails)->setSubject('The Order Status has been updated.')->send(); }
public function getRalationValue($id) { switch ($this->attribute) { case 'order_status_id': $value = OrderStatus::findOne($id); break; case 'store_id': $value = Store::findOne($id); break; case 'payment_method_id': $value = PaymentMethod::findOne($id); break; case 'payment_status_id': $value = PaymentStatus::findOne($id); break; case 'shipping_method_id': $value = ShippingMethod::findOne($id); break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; // case 'order_status_id': // $value = OrderStatus::findOne($id); // break; default: # code... break; } if ($value !== null) { return $value->name; } }
protected function findModel($id) { if (($model = Store::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }