Skip to content

Commit

Permalink
Merge branch task/PP-8741 into master
Browse files Browse the repository at this point in the history
task/PP-8741: Prestashop Payment Icons Improvement
  • Loading branch information
vekkon authored Apr 6, 2023
2 parents 7ac234d + 294da94 commit 01fc6c3
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
22 changes: 20 additions & 2 deletions payrexx/payrexx.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct()
$this->name = 'payrexx';
$this->tab = 'payments_gateways';
$this->module_key = '0c4dbfccbd85dd948fd9a13d5a4add90';
$this->version = '1.4.1';
$this->version = '1.4.4';
$this->author = 'Payrexx';
$this->is_eu_compatible = 1;
$this->ps_versions_compliancy = ['min' => '1.7'];
Expand All @@ -46,7 +46,8 @@ public function install()
// Install default
if (!parent::install() ||
!$this->installDb() ||
!$this->registerHook('paymentOptions')
!$this->registerHook('paymentOptions') ||
!$this->registerHook('actionFrontControllerSetMedia')
) {
return false;
}
Expand Down Expand Up @@ -265,6 +266,21 @@ private function postProcess()
$this->context->controller->confirmations[] = 'Settings are successfully updated.';
}

/**
* Add asset for Shop Front Office
*
* @see https://devdocs.prestashop.com/1.7/themes/getting-started/asset-management/#without-a-front-controller-module
*
* @param array $params
*/
public function hookActionFrontControllerSetMedia(array $params)
{
$this->context->controller->registerStylesheet(
'payrexx-payment-method-icon',
'/modules/' . $this->name . '/views/css/custom.css'
);
}

/**
* Return payment options
*
Expand All @@ -289,6 +305,7 @@ public function hookPaymentOptions($params)

$paymentOption = new PaymentOption();
$paymentOption->setAction($action);
$paymentOption->setModuleName($this->name);
$paymentOption->setCallToActionText($this->l($title));
$paymentOption->setInputs(
[
Expand All @@ -301,6 +318,7 @@ public function hookPaymentOptions($params)
);
$paymentOption->setLogo($imageSrc);
if ($paymentMethod['pm'] == 'payrexx') {
$paymentOption->setLogo('');
$paymentOption->setAdditionalInformation(
$this->l('Payrexx payment method description')
);
Expand Down
16 changes: 16 additions & 0 deletions payrexx/upgrade/Upgrade-1.4.4.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Payrexx Payment Gateway - upgrade the module
*
* @author Payrexx <[email protected]>
* @copyright 2023 Payrexx
* @license MIT License
*/
if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_1_4_4($module)
{
return $module->registerHook('actionFrontControllerSetMedia');
}
3 changes: 3 additions & 0 deletions payrexx/views/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.payment-option img {
max-height: 40px;
}
17 changes: 17 additions & 0 deletions payrexx/views/css/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Payrexx Payment Gateway.
*
* @author Payrexx <[email protected]>
* @copyright 2023 Payrexx
* @license MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

header('Location: ../');
exit;
Loading

0 comments on commit 01fc6c3

Please sign in to comment.