Magento – Call to undefined method Mage_Core_Model_Layout_Element::getIsAnonymous()

blocksmagento-1.8

Synopsis

All I want to do is implement a 'form' to the right column of my magento store. Problem is I have a custom theme which removes right and implements their own view.

Right now, I couldn't care less where this form is displayed, I just want it to display something, somewhere.

If I hack the view similarly to the following, my form works:

<?= $this->getLayout()->createBlock('quickadd/checkout_form_quickadd')->setTemplate('vendor/quickadd.phtml') ?>

The contents of my template is output.

When I use the stupid layout.xml <update handle=""> junk that Magento implements I get this error:

PHP Fatal error: Call to undefined method Mage_Core_Model_Layout_Element::getIsAnonymous() in /home/elusr/public_html/app/code/core/Mage/Core/Block/Abstract.php on line 694

I don't understand what's going on…

example code:

File: config.xml

...
<global>
    <helpers>
        <quickadd>
            <class>Vendor_QuickAdd_Helper</class>
        </quickadd>
    </helpers>
    <blocks>
        <quickadd>
            <class>Vendor_QuickAdd_Block</class>
        </quickadd>
    </blocks>
</global>

...

<frontend>
    <layout>
        <updates>
            <quickadd>
                <file>vendor/quickadd.xml</file>
            </quickadd>
        </updates>
    </layout>
</frontend>

File: vendor/quickadd.xml
<layout>
    <vendor_quickadd>
        <reference name="product.info">
            <action method="insert">
                <block type="quickadd/checkout_form_quickadd" name="quickadd" template="vendor/quickadd.phtml" />
            </action>
        </reference>
    </vendor_quickadd>
    <catalog_product_view>
        <update handle="vendor_quickadd" />
    </catalog_product_view>
</layout>

Best Answer

Why do you need update? Try this one:

<layout>
    <catalog_product_view>
       <reference name="product.info">
            <block type="quickadd/checkout_form_quickadd" name="quickadd" template="vendor/quickadd.phtml" />
        </reference>
    </catalog_product_view>
</layout>

If you want handle try this:

<layout>
    <vendor_quickadd>
        <reference name="product.info">
            <block type="quickadd/checkout_form_quickadd" name="quickadd" template="vendor/quickadd.phtml" />
            <action method="insert"><block>quickadd</block></action>
        </reference>
    </vendor_quickadd>
    <catalog_product_view>
        <update handle="vendor_quickadd" />
    </catalog_product_view>
</layout>