Answer the question
In order to leave comments, you need to log in
What is the easiest way to implement this idea?
The point is this. More precisely, what is now implemented.
The client selects a service on the site, enters his full name, mail and places an order for the service. This order comes to the admin panel. But you need to complete the processing and confirmation.
Namely / From the admin panel, you need to send an email to the customer with a ticket for the service and a confirm button.
Let's say:
Ultrasound coupon
05/12/2018
8:45 AM
210 Office of the
Medical Unit
Well, here is the Confirm button.
By clicking which the status of the order changes to confirmed. How to send a coupon to a client is not difficult in principle, I am interested in the confirmation procedure. How difficult is it
Answer the question
In order to leave comments, you need to log in
class Order {
const SECRET_KEY = 'not-log-secret-key-2213123123';
}
class OrderController extends Controller {
public function actionConfirm($token){
if ($id = \Yii::$app->security->validateData($token, Order::SECRET_KEY)){
if (($order = Order::findOne($id)) && $order->updateAttributes(['confirmed' => true])){
Yii::$app->session->addFlash('success', 'Талон подтвержден');
return $this->redirect('orders');
}
}
throw new NotFoundHttpException();
}
}
In the status of the order, put not confirmed, even the same order in the table (or you can create a separate one so as not to litter), generate a hash code for confirmation, and the confirm button is a regular link to the confirmation action and as a get parameter takes the same hash on it, find your order and set status confirmed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question