I have been digging in this, cleaning up ancient hacks to show additional information with each of the payment modules on offer in the catalog.
I think the process is worthy of documentation, and maybe some reworking...
MODULE_PAYMENT_COD_TEXT_TITLE - used in catalog and admin
MODULE_PAYMENT_COD_TEXT_DESCRIPTION - used in admin only, in the infobox.
Note that changes in override files are not used/do not show up in the admin, only the original constants.
To use MODULE_PAYMENT_COD_TEXT_DESCRIPTION in the catalog a couple of edits are required
in the payment module
function selection() {//steve edited - shown on checkout_payment
/* ORIGINAL return array('id' => $this->code,
'module' => $this->title);*/
return array('id' => $this->code,
'module' => $this->title,
**'description' => $this->description);//steve added**
}
Now in tpl_checkout_payment.php it can be used
<label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label>
<?php echo $selection[$i]['description']; //steve added ?>
I wanted to add icons in that description which would have shown up in the admin as broken links, but since the overrides are not used in the admin, it's ok.
Or, you can add an extra define eg:
MODULE_PAYMENT_COD_ICON
add the code:
function selection() {//steve edited - shown on checkout_payment
/* ORIGINAL return array('id' => $this->code,
'module' => $this->title);*/
return array('id' => $this->code,
'module' => $this->title,
'description' => $this->description,
**'icon' => MODULE_PAYMENT_COD_ICON);//steve added**
}
and in the template
> <label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label>
**<?php echo $selection[$i]['icon']; //steve added ?>**
<?php echo $selection[$i]['description']; //steve added ?>
There is another built-in way which in the end I have opted to use.
In the module:
function selection() {//steve edited - shown on checkout_payment
/* ORIGINAL return array('id' => $this->code,
'module' => $this->title);*/
return array('id' => $this->code,
'module' => $this->title,
**'fields'=>array(array('title' =>MODULE_PAYMENT_COD_CATALOG_ICON,
'field' => MODULE_PAYMENT_COD_TEXT_DESCRIPTION)) **);
}
and this gets output automatically by the original code in the tpl_checkout_payment.php:
<div class="ccinfo">
<?php
for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
?>
<label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?>
<br class="clearBoth" />
<?php
}
?>
</div>
I note the "title" array item is wrapped in a label tag and provision is made to add the "for" tag to this label. Not sure what the reasoning behind this is/was. Possibly to make the whole text block clickable to select the radio button?
In which case the template needs to be modified.
<label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="**pmt-**'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?>
So, several ways to skin the cat here. I prefer the last method to add extra info to the payment method. It needs some styling to get it shipshape but I just wanted to explain the bones of it.
I also put the payment methods in divs with styling to better control the positioning of the subsequent text.
And on the checkout confirmation page, you can do similar stuff with this function in the module:
> function confirmation() {//steve edited, shown on checkout_confirmation
return array('title' => '',
'fields'=>array(array('title' =>MODULE_PAYMENT_COD_CATALOG_ICON',
'field' => MODULE_PAYMENT_COD_TEXT_DESCRIPTION)) );
}