Hello,
I am using Prestashop 1.7.7.1 and what I see here admin Order view is totally changed.
AdminOrderController is removed.
What I am trying to do is follwoing:
1. I have created a module to send a alert email to customers.
2. I have created a button "Send alert to customer" in admin using hook "actionGetAdminOrderButtons". See below image.
3. This button has link to same order page with additional parameter in url to identify that button is clicked.
4. When button is clicked, I get additional parameter in url and I calculate some data and send email to user.
5. Till now there is no problem.
6. The problem is I wanna display a success message if email is sent and error message if something went wrong.
Here is my code as well
public function hookActionGetAdminOrderButtons(array $params)
{
$id_order = $params['id_order'];
$order = new Order((int)$id_order);
$order_state = new OrderState((int)$order->current_state);
/** @var \Symfony\Bundle\FrameworkBundle\Routing\Router $router */
$router = $this->get('router');
/** @var \PrestaShopBundle\Controller\Admin\Sell\Order\ActionsBarButtonsCollection $bar */
$bar = $params['actions_bar_buttons_collection'];
$viewOrderUrl = $router->generate('admin_orders_view', ['orderId'=> $id_order]);
$sendPickupAlertUrl = $viewOrderUrl.'¬ify=1';
$bar->add(
new \PrestaShopBundle\Controller\Admin\Sell\Order\ActionsBarButton(
'btn-secondary', ['href' => $sendPickupAlertUrl], 'Send Alert to Customer'
)
);
if(Tools::getValue('notify'))
{
// Calculate some data
// Send email to customer
if($success)
Show success message.
else
show error message.
}
}
Can anyone help me how to display success or error notification message like above screenshot?
Thanks in advance
Peter