Hi!
I have spent about three hours searching the forum and the internet and have found nothing. I would like to make a button I created using hookActionGetAdminOrderButtons launch the content of the controller it points to, in a modal window, instead of redirecting.
Basically, I want to create a button that sends to an external endpoint a set of order data (for example, confirming the payment of a pre-authorization made on an external payment gateway). Now I have made that button redirects me to a very simple page where I fill in the data to be sent. I would like this to be shown in a modal, as it is much more comfortable for the user. How do I show the content of this TPL in a modal?
Code of the hook:
public function hookActionGetAdminOrderButtons(array $params){ $orderDetails = xxx::getOrderDetails($params['id_order']); if(xxx){ if(xxx){ $bar = $params['actions_bar_buttons_collection']; $bar->add( new \PrestaShopBundle\Controller\Admin\Sell\Order\ActionsBarButton( 'btn-info', ['href' => $this->_endpoint_xxx . "&id_order=" . $params['id_order']], 'Confirm payment' ) ); $bar->add( new \PrestaShopBundle\Controller\Admin\Sell\Order\ActionsBarButton( 'btn-info', ['href' => $this->_endpoint_xxx . "&id_order=" . $params['id_order']], 'Cancel payment' ) ); } } }
The TPL:
<div class="wrap"> <h1>Order #{$orderId}</h1> <form method="POST"> <p>Fullfill amount of order #{$orderId}.</p> <div class="form-group"> <label for="amount">Amount (*)</label> <input name="amount" type="number" step="0.01" value="{$amount}" /> </div> <br/> <input type="submit" value="Cancel payment"> </form> </div>
PS: I simplified names of variable and other not important things in order to no make the post too long and because of the privacy of some parts of the code.
Buttons added:
Page wich the button "anular pago" redirects to:
Thank you so much in advance!!