4

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.

<checkout_onepage_paymentmethod>
    <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" />
            </action>
        </block>
    </block>
</checkout_onepage_paymentmethod>

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

3

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" />
    </action>
</block>

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')
           ->setTemplate('checkout/onepage/payment/cashondelivery.phtml');
    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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.