Creating the payment controller

We will now create a front controller named Payment. But first of all, in displayPayment.tpl, set the link to the controller on the href attribute using the getModuleLink method (which we also saw in the previous chapter):

<a href="{$link->getModuleLink('mymodpayment',
'payment')|escape:'html'}" class="mymodpayment">

Next, create the payment.php file in the controllers/front/ directory of your module and fill it with a front controller that will display the payment.tpl template:

<?php class MyModPaymentPaymentModuleFrontController extends ModuleFrontController { public $ssl = true; public function initContent() { // Call parent init content method parent::initContent(); // Set template $this->setTemplate('payment.tpl'); ...

Get PrestaShop Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.