I am developing a custom payment module in PrestaShop 1.6. My front controller path is: mymodule/controllers/front/payment.php
payment.php contains:
$this->context->smarty->assign(array(
'dataCompleteURL' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__.'index.php?fc=module&module=mymodule&controller=callback&cart='.$cartID));
$this->setTemplate('payment.tpl');
My template file path is:
mymodule/views/templates/front/payment.tpl
payment.tpl contains:
<script src="http://easternbank.test.gateway.com/checkout.js" data-complete="{$dataCompleteURL}" type="text/javascript"> </script>
The problem is that in my localhost it is working fine. I get the data-complete URL in the script tag. But when I install the module in my test server I do not get the data-complete URL.
Any help or suggestion will be appreciated.
Thanks in advance.
UPDATE
I have found that the problem is "https" in the "src" of the script tag. I can not understand why data-complete vanishes if the src URL begins with https. Without https it is okay.
When I view the source in the browser for the following code with https in src, I get:
<script src="http://easternbank.test.gateway.com/checkout.js" data-complete="{$dataCompleteURL}" type="text/javascript"> </script>
The data-complete attribute vanishes. But when I view the source of the script with src without "https" I get the data-complete attribute.
I could not find the reason.
OR I can add javascript in the payment.php controller using :
$this->context->controller->addJS(($this->_path).'js/checkout.js');
But I do not know how to pass data attributes in the addJS function.