Skip to content

Commit

Permalink
Added option to show issuer logo's on checkout (iDEAL, KBC & Giftcard)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin-Magmodules committed Dec 18, 2018
1 parent 6ca27d3 commit b829dfd
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 37 deletions.
37 changes: 33 additions & 4 deletions app/code/community/Mollie/Mpm/Block/Payment/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public function getMethodLabelAfterHtml()

$labelBlock = Mage::app()->getLayout()->createBlock(
'core/template', null, array(
'template' => 'mollie/mpm/payment/label.phtml',
'payment_method_icon' => isset($method->image->size2x) ? $method->image->size2x : '',
'payment_method_label' => $this->getMethod()->getTitle(),
'payment_method_class' => $this->getMethod()->getCode()
'template' => 'mollie/mpm/payment/label.phtml',
'payment_method_icon' => isset($method->image->size2x) ? $method->image->size2x : '',
'payment_method_label' => $this->getMethod()->getTitle(),
'payment_method_class' => $this->getMethod()->getCode()
)
);
$this->setData('_method_label_html', $labelBlock->toHtml());
Expand All @@ -84,4 +84,33 @@ public function getMethodByCode($code)
{
return $this->mollieHelper->getMethodByCode($code);
}

/**
* @param $code
*
* @return mixed
*/
public function getIssuerListType($code)
{
return $this->mollieHelper->getIssuerListType($code);
}

/**
* @param $code
*
* @return string
*/
public function getIssuerTitle($code)
{
if ($code == 'mollie_ideal' || $code == 'mollie_kbc') {
return $this->__('Select Bank');
}

if ($code == 'mollie_giftcard') {
return $this->__('Select Giftcard');
}

return $this->__('Select Issuer');
}

}
13 changes: 3 additions & 10 deletions app/code/community/Mollie/Mpm/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ class Mollie_Mpm_Helper_Data extends Mage_Core_Helper_Abstract
const XPATH_LOCALE = 'payment/mollie/locale';
const XPATH_IMAGES = 'payment/mollie/payment_images';
const XPATH_USE_BASE_CURRENCY = 'payment/mollie/currency';
const XPATH_IDEAL_ISSUER_LIST_TYPE = 'payment/mollie_ideal/issuer_list_type';
const XPATH_GIFTCARD_ISSUER_LIST_TYPE = 'payment/mollie_giftcard/issuer_list_type';
const XPATH_PAYMENTLINK_ADD_MESSAGE = 'payment/mollie_paymentlink/add_message';
const XPATH_ISSUER_LIST_TYPE = 'payment/%method%/issuer_list_type';
const XPATH_PAYMENTLINK_MESSAGE = 'payment/mollie_paymentlink/message';
const XPATH_API_METHOD = 'payment/%method%/method';

Expand Down Expand Up @@ -261,13 +259,8 @@ public function useImage($storeId = null)
*/
public function getIssuerListType($method)
{
if ($method == 'mollie_methods_ideal') {
return $this->getStoreConfig(self::XPATH_IDEAL_ISSUER_LIST_TYPE);
}

if ($method == 'mollie_methods_giftcard') {
return $this->getStoreConfig(self::XPATH_GIFTCARD_ISSUER_LIST_TYPE);
}
$methodXpath = str_replace('%method%', $method, self::XPATH_ISSUER_LIST_TYPE);
return $this->getStoreConfig($methodXpath);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ public function toOptionArray()
'value' => 'dropdown',
'label' => $this->mollieHelper->__('Dropdown')
),
/*
array(
'value' => 'radio',
'label' => $this->mollieHelper->__('List with images')
),
*/
array(
'value' => 'none',
'value' => '',
'label' => $this->mollieHelper->__('Don\'t show issuer list')
)
);
Expand Down
5 changes: 4 additions & 1 deletion app/code/community/Mollie/Mpm/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,17 @@
<title>iDEAL</title>
<model>mpm/method_ideal</model>
<group>mollie</group>
<issuer_list_type>dropdown</issuer_list_type>
<allowspecific>0</allowspecific>
<method/>
</mollie_ideal>
<mollie_kbc>
<active>1</active>
<sort_order>60</sort_order>
<title>KBC</title>
<title>KBC/CBC</title>
<model>mpm/method_kbc</model>
<group>mollie</group>
<issuer_list_type>dropdown</issuer_list_type>
<allowspecific>0</allowspecific>
<method/>
</mollie_kbc>
Expand Down Expand Up @@ -353,6 +355,7 @@
<title>Giftcard</title>
<model>mpm/method_giftcard</model>
<group>mollie</group>
<issuer_list_type>dropdown</issuer_list_type>
<allowspecific>0</allowspecific>
<method/>
</mollie_giftcard>
Expand Down
16 changes: 14 additions & 2 deletions app/code/community/Mollie/Mpm/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
<label>Status Pending</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status_new</source_model>
<sort_order>23</sort_order>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
Expand Down Expand Up @@ -990,7 +990,7 @@
</fields>
</mollie_ideal>
<mollie_kbc translate="label" module="mpm">
<label>Mollie - KBC</label>
<label>Mollie - KBC/CBC</label>
<expanded>0</expanded>
<sort_order>130</sort_order>
<frontend_type>text</frontend_type>
Expand Down Expand Up @@ -1031,6 +1031,18 @@
<active>1</active>
</depends>
</method>
<issuer_list_type translate="label tooltip">
<label>Issuer List Style</label>
<frontend_type>select</frontend_type>
<source_model>mpm/adminhtml_system_config_source_issuerListType</source_model>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<depends>
<active>1</active>
</depends>
</issuer_list_type>
<allowspecific translate="label">
<label>Payment from Applicable Countries</label>
<frontend_type>allowspecific</frontend_type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,35 @@
$code = $this->getMethodCode();
$method = $this->getMethodByCode($code);
?>
<?php if (!empty($method->issuers)): ?>
<?php if (!empty($method->issuers) && ($listType = $this->getIssuerListType($code))): ?>
<ul class="form-list" id="payment_form_<?= $this->escapeHtml($code) ?>" style="display:none">
<li>
<label for="<?= $code ?>_issuer" class="required">
<em>*</em><?= $this->__('Please select'); ?>
<label for="<?= $code ?>_issuer">
<?= $this->getIssuerTitle($code); ?>
</label>
<span class="input-box">
<select name="<?= $code; ?>_issuer" id="<?= $code; ?>_issuer" class="required-entry input-text">
<option value=""><?= $this->__('Please select'); ?></option>
<?php
foreach ($method->issuers() as $issuer):
echo '<option value="' . htmlspecialchars($issuer->id) . '">' . htmlspecialchars($issuer->name) . '</option>';
endforeach;
?>
</select>
</span>
<?php if ($listType == 'dropdown'): ?>
<select name="<?= $code; ?>_issuer" id="<?= $code; ?>_issuer" class="input-text">
<option value=""><?= $this->__('Please select'); ?></option>
<?php foreach ($method->issuers() as $issuer): ?>
<option value="<?= htmlspecialchars($issuer->id); ?>">
<?= htmlspecialchars($issuer->name); ?>
</option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<?php if ($listType == 'radio'): ?>
<ul>
<?php foreach ($method->issuers() as $issuer): ?>
<li>
<input type="radio" name="<?= $code; ?>_issuer" value="<?= htmlspecialchars($issuer->id); ?>" id="issuer_<?= htmlspecialchars($issuer->id); ?>" class="radio">
<img src="<?= $issuer->image->size2x; ?>" class="payment-issuer-icon"/>
<?= htmlspecialchars($issuer->name); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</span>
</li>
</ul>
<?php endif; ?>
13 changes: 8 additions & 5 deletions skin/frontend/base/default/mollie/mpm/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@
margin-right: auto;
}

.payment-issuer-icon {
width: 27px;
vertical-align: middle;
display: inline-block;
margin: 5px 3px 5px 3px;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

#checkout-payment-method-load input.radio {
float: left;
}
}

0 comments on commit b829dfd

Please sign in to comment.