1

I'm trying to add new block to billing form in my custom layout file. I've debugged method getFileLayoutUpdatesXml from Mage_Core_Model_Layout_Update and i see that my file is loaded. I have the following file

newsletteronbillingform.xml

<?xml version="1.0"?>
<layout>
    <checkout_onepage_index>
        <reference name="checkout.onepage.billing">
            <block type="company_newsletteronbillingform/newsletter" name="checkout.onepage.billing.extra" template="newsletter/billingform/checkbox.phtml" />
        </reference>
    </checkout_onepage_index>
</layout>

When i add this directly in layout checkout.xml then works correctly

        <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="checkout/onepage/login.phtml">
            <block type="page/html_wrapper" name="checkout.onepage.login.before" as="login_before" translate="label">
                <label>Login/Registration Before</label>
                <action method="setMayBeInvisible"><value>1</value></action>
            </block>
            <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml">
                <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
                <block type="company_newsletteronbillingform/newsletter" name="checkout.onepage.billing.extra" template="newsletter/billingform/checkbox.phtml" />
            </block>

            <block type="cms/block" name="checkout_login_info_guest">
                <action method="setBlockId"><block_id>checkout_login_info_guest</block_id></action>
            </block>
            <block type="cms/block" name="checkout_login_info_register">
                <action method="setBlockId"><block_id>checkout_login_info_register</block_id></action>
            </block>

        </block>

What am I doing wrong?

[SOLUTION]

The reason was my oversight... :) I had doubly declared block "checkout.onepage.billing". After removing unnecessary second block it works correctly. Thx for help.

0

1.Here the code is mine. Add your own code as per need.

2.You can add your code in local.xml.

<?xml version="1.0"?>
<layout version="0.1.0">
    <checkout_onepage_index>
        <reference name="checkout.onepage.billing">
        <block type="core/template" name="custom"  template="checkout/custom.phtml" as="custom"></block>
    </reference>
    </checkout_onepage_index>
</layout>

3.Add <?php echo $this->getChildHtml('custom');?> in billing.phtml

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