From 8b496e26a89917037246865d1ea63cea2993dd25 Mon Sep 17 00:00:00 2001 From: Max Geraci Date: Mon, 20 Apr 2020 12:31:49 +0200 Subject: [PATCH] Added option to show payment images in checkout --- paynlpaymentmethods/nl.php | 2 ++ paynlpaymentmethods/paynlpaymentmethods.php | 27 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/paynlpaymentmethods/nl.php b/paynlpaymentmethods/nl.php index 0b8e186..ddd32c4 100644 --- a/paynlpaymentmethods/nl.php +++ b/paynlpaymentmethods/nl.php @@ -31,6 +31,8 @@ $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_b9f5c797ebbf55adccdd8539a65a0241'] = 'Uitgeschakeld'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_4245499695408b974322be6f01b0d17a'] = 'Test modus'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_61142607f22ea506073bcb1c1c74133e'] = 'Start de transacties in sandbox modus om te testen'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_4861c3d5c88af6037e2bfb0d5c309ce1'] = 'Weergave afbeeldingen'; +$_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_f7d5170bde3cbe04f1e4c3cb3459dc08'] = 'Laat de afbeeldingen van de betaalmethoden zien in de checkout.'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_3d8bf69f189462bae437c9b50d32f4e1'] = 'Betaalscherm taal'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_1efea134dc382b9d18ef9ed8a21e178f'] = 'Selecteer de taal waarin het betaalscherm wordt weergegeven, gebruikt automatisch de browser taal'; $_MODULE['<{paynlpaymentmethods}prestashop>paynlpaymentmethods_c9cc8cce247e49bae79f15173ce97354'] = 'Opslaan'; diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index 716867b..24dac67 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -203,8 +203,10 @@ private function getPaymentMethods($cart = null) 'value' => $paymentMethod->id, ], ]) - ->setLogo('https://static.pay.nl/payment_profiles/50x32/' . $paymentMethod->id . '.png'); - if (isset($paymentMethod->description)) { + if (Configuration::get('PAYNL_SHOW_IMAGE')) { + $objPaymentMethod-> + setLogo('https://static.pay.nl/payment_profiles/50x32/' . $paymentMethod->id . '.png'); + } if (isset($paymentMethod->description)) { $objPaymentMethod->setAdditionalInformation('

' . $paymentMethod->description . '

'); } @@ -981,6 +983,8 @@ protected function _postProcess() Configuration::updateValue('PAYNL_DESCRIPTION_PREFIX', Tools::getValue('PAYNL_DESCRIPTION_PREFIX')); Configuration::updateValue('PAYNL_PAYMENTMETHODS', Tools::getValue('PAYNL_PAYMENTMETHODS')); Configuration::updateValue('PAYNL_LANGUAGE', Tools::getValue('PAYNL_LANGUAGE')); + Configuration::updateValue('PAYNL_SHOW_IMAGE', Tools::getValue('PAYNL_SHOW_IMAGE')); + } $this->_html .= $this->displayConfirmation($this->l('Settings updated')); } @@ -1051,6 +1055,24 @@ public function renderAccountSettingsForm() ) ), ), + array( + 'type' => 'switch', + 'label' => $this->l('Show images'), + 'name' => 'PAYNL_SHOW_IMAGE', + 'desc' => $this->l('Show the images of the payment methods in checkout.'), + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ), + ), array( 'type' => 'select', 'label' => $this->l('Payment screen language'), @@ -1114,6 +1136,7 @@ public function getConfigFieldsValues() 'PAYNL_VALIDATION_DELAY' => Tools::getValue('PAYNL_VALIDATION_DELAY', Configuration::get('PAYNL_VALIDATION_DELAY')), 'PAYNL_DESCRIPTION_PREFIX' => Tools::getValue('PAYNL_DESCRIPTION_PREFIX', Configuration::get('PAYNL_DESCRIPTION_PREFIX')), 'PAYNL_LANGUAGE' => Tools::getValue('PAYNL_LANGUAGE', Configuration::get('PAYNL_LANGUAGE')), + 'PAYNL_SHOW_IMAGE' => Tools::getValue('PAYNL_SHOW_IMAGE', Configuration::get('PAYNL_SHOW_IMAGE')), 'PAYNL_PAYMENTMETHODS' => $paymentMethods ); }