Search code examples
magentooverridingextendbilling

Extend Onepage Billing block in Magento


I hope someone already knows how solve this as I've been trying for a couple of days, followed countless tutorials and sadly not got far.

I am attempting to override the block file : /app/code/core/Mage/Checkout/Block/Onepage/Billing.php in a custom module (for Magento 1.7)

in my module config.xml file, I have added the following:

<global>
    <blocks>
        <checkout>
            <rewrite>
                <onepage_billing>
                    Jrc_GiftListShipping_Block_Onepage_Billing
                </onepage_billing>
            </rewrite>
        </checkout>
    </blocks>
</global>

and created a file in the following location:

/app/code/local/Jrc/GiftListShipping/Block/Onepage/Billing.php which contains the following simple code:

<?php
Class Jrc_GiftListShipping_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
{
    protected function _construct()
    {
        parent::_construct();
    }
}

However the above generates an exception:

exception 'Mage_Core_Exception' with message 'Invalid block type: Jrc_GiftListShipping_Block_Onepage_Billing

I can't see anything wrong with the code above but I really hope someone else can and educate me a little


Solution

  • <onepage_billing>Jrc_GiftListShipping_Block_Onepage_Billing</onepage_billing>
    

    Don't use reformat code for xml in magento