I have a payment method block. I saw that I can add custom HTML after the label in one page payment using the getMethodLabelAfterHtml method.

I want to be able to pass a HTML string to the setMethodLabelAfterHtml of my payment method.

    <remove name="right"/>
    <remove name="left"/>

    <block type="checkout/onepage_payment_methods" name="root" output="toHtml" template="checkout/onepage/payment/methods.phtml">
        <block type="core/template" name="payment.method.cashondelivery">
            <action method="setMethodLabelAfterHtml">
                <block type="core/template" name="payment.method.cashondelivery.picto" output="toHtml" template="checkout/onepage/payment/cashondelivery.phtml" />

I am unable to get the toHTML version of my template cashondelivery.phtml and pass it to the setMethodLabelAfterHtml action all only using the xml layout files.

1 Answer 1


you can use helpers to get the value for a specific parameter: Something like this:

<block type="core/template" name="payment.method.cashondelivery">
    <action method="setMethodLabelAfterHtml">
         <html helper="[helper_alias]/getCacheOnDeliveryHtml" />

now you need to create a module with a helper and in that helper add this:

public function getCacheOnDeliveryHtml()
    $block = Mage::app()->getLayout()->createBlock('core/template')
    return $block->toHtml();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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