i have recently enabled the paypal Pro service, and now I'm setting it up for my PrestaShop version 1.6.1.1.
I must point out the url of thank you page and the error page.
For the thank you page, I had no problem, I simulated a purchase and copied the url by putting the placeholder.
I used this:
module/paypal/submit?id_cart={id_cart}&id_module=97&id_order={id_order}&key={id_key}
I found difficulty by setting up the error page url.
In templates/front I noticed that there is already tpl for this. and in paypal.php I find this function:
public function displayPayPalAPIError($message, $log = false)
{
$send = true;
// Sanitize log
foreach ($log as $key => $string) {
if ($string == 'ACK -> Success') {
$send = false;
} elseif (Tools::substr($string, 0, 6) == 'METHOD') {
$values = explode('&', $string);
foreach ($values as $key2 => $value) {
$values2 = explode('=', $value);
foreach ($values2 as $key3 => $value2) {
if ($value2 == 'PWD' || $value2 == 'SIGNATURE') {
$values2[$key3 + 1] = '*********';
}
}
$values[$key2] = implode('=', $values2);
}
$log[$key] = implode('&', $values);
}
}
$this->context->smarty->assign(array('message' => $message, 'logs' => $log));
if ($send) {
$id_lang = (int) $this->context->language->id;
$iso_lang = Language::getIsoById($id_lang);
if (!is_dir(dirname(__FILE__).'/mails/'.Tools::strtolower($iso_lang))) {
$id_lang = Language::getIdByIso('en');
}
Mail::Send(
$id_lang,
'error_reporting',
Mail::l('Error reporting from your PayPal module', (int) $this->context->language->id),
array('{logs}' => implode('<br />', $log)),
Configuration::get('PS_SHOP_EMAIL'),
null,
null,
null,
null,
null,
_PS_MODULE_DIR_.$this->name.'/mails/'
);
}
return $this->fetchTemplate('error.tpl');
Is there a routing rule that calls the order's template with the hook error.tpl?
No there's no routing rule for it. From what I've managed to understand by going through the module code is that the error template is displayed if an order's current state has an email template of payment_error
(template of Payment Error
state).
So if you set an order's current state to Payment Error
and visit the same link you wrote in the question it should display error template.