Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook to give ability to add scripts into return controller #952

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,17 @@ public function hookActionFrontControllerInitAfter(): void
$this->frontControllerAfterInit();
}

/**
* Hook used for displaying the return page top where the customer is redirected after payment
* Used if content like Google Analytics is being used.
*
* @return string
*/
public function hookDisplayMollieReturnPageTop(): string
{
return '';
}

private function frontControllerAfterInit(): void
{
if (!$this->context->controller instanceof OrderControllerCore) {
Expand Down
1 change: 1 addition & 0 deletions src/Install/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public static function getHooks()
'displayProductAdditionalInfo',
'displayCustomerAccount',
'actionCarrierUpdate',
'displayMollieReturnPageTop',
];
}

Expand Down
22 changes: 22 additions & 0 deletions upgrade/Upgrade-6.2.2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Mollie https://www.mollie.nl
*
* @author Mollie B.V. <info@mollie.nl>
* @copyright Mollie B.V.
* @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md
*
* @see https://github.com/mollie/PrestaShop
*/

use Mollie\Adapter\ConfigurationAdapter;
use Mollie\Config\Config;

if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_6_2_2(Mollie $module): bool
{
return $module->registerHook('displayMollieReturnPageTop');
}
3 changes: 3 additions & 0 deletions views/templates/front/mollie_return.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* @see https://github.com/mollie/PrestaShop
* @codingStandardsIgnoreStart
*}

{hook h='displayMollieReturnPageTop'}

<h2>{l s='Welcome back' mod='mollie'}</h2>
<p>{$msg_details|escape:'htmlall':'UTF-8'}</p>
<a class="btn btn-default" href="{$link->getPageLink('index', true)|escape:'htmlall':'UTF-8'}">
Expand Down
Loading