I'm looking to programmatically add an extra label to my payment options and while studying methods.phtml I see the following code:

<?php echo $this->getMethodLabelAfterHtml($_method); ?>

Now it seems this is exactly what I need, but I have no idea how to use it. It sure looks very similar to:

<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
    <?php echo $html; ?>

I know this calls the form.pthml corresponding to the currently parsed payment method. Does getMethodLabelAfterHtml($_method) also work with a .pthml file? And if yes, where do I put it and are there examples available?


So what you need to do is call the function setMethodLabelAfterHtml on your payment block and pass this function the html that you want to display.

I good example of this is found in the module Mage_Paypal.

Here the block Mage_Paypal_Block_Standard_Form which extends Mage_Payment_Block_Form calls this setMethodLabelAfterHtml during the _construct

Basically what you would need to do is make a block using type core/template, sets the desired template and then passes the result of this block's toHtml function into setMethodLabelAfterHtml.

$mark = Mage::getConfig()->getBlockClassName('core/template');
$mark = new $mark;
$mark->setTemplate('your /custom/template.phtml');
return parent::_consturct();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.