Jump to content

Edit History

David

David

Hey. I am not a prestashop master, and I am asking the same thing.

 

There is an

 

$this->addFlash('error','text');

 

but this will fail since we are not in a controller (it should extends controller)

 

Here what I found :

Tools::displayError('Erro text');

 

 

I hope it will helps

 

 

 

Other way (I dont know if it's ok, but it works)

public function hookDisplayAdminOrderTop($params) {

$order = new Order($params['id_order']);

$router = $this->get('router');

if (....) (GET or something)

{

$message_txt="Yeah.";
$type="success"; // can be error..
$this->get('session')->getFlashBag()->add($type, $message_txt);
$urlResend = $router->generate('admin_orders_view', ['orderId'=> (int)$order->id]);

Tools::redirectAdmin($urlResend);

}

}

 

David

David

Hey. I am not a prestashop master, and I am asking the same thing.

 

There is an

 

$this->addFlash('error','text');

 

but this will fail since we are not in a controller (it should extends controller)

 

Here what I found :

Tools::displayError('Erro text');

 

 

I hope it will helps

 

 

 

Other way (I dont know if it's ok, but it works)

public function hookDisplayAdminOrderTop($params) {

$order = new Order($params['id_order']);

$router = $this->get('router');

if (....) (GET or something)

{

$message_txt="Yeah.";
$this->get('session')->getFlashBag()->add($type, $message_txt);
$urlResend = $router->generate('admin_orders_view', ['orderId'=> (int)$order->id]);

Tools::redirectAdmin($urlResend);

}

}

 

David

David

Hey. I am not a prestashop master, and I am asking the same thing.

 

There is an

 

$this->addFlash('error','text');

 

but this will fail since we are not in a controller (it should extends controller)

 

Here what I found :

Tools::displayError('Erro text');

 

 

I hope it will helps

×
×
  • Create New...