Magento – How to Add Block to product.info on in local.xml

layout

In local.xml, the following block exists. This does not insert the block into the product.info block (IE getChild('addtolinks') returns false). Inserting the same snippet in catalog.xml works just as expected. I don't believe the issue is with the handle (catalog_product_view) or reference (name="product.info") because <remove name="something.in.product.info" /> in the same scope as the block works just fine. Any ideas?

<layout>
  <!-- etc... -->
  <catalog_product_view>


    <reference name="product.info">

      <block type="my_catalog/addto_links" name="product.info.addtolinks" as="addtolinks" template="page/template/links.phtml">

        <action method="setProduct">
          <product helper="catalog/getProduct" />
        </action>

        <action method="addLink">
          <label>Add to Wishlist</label>
          <helper>wishlist</helper>
          <title>Add to Wishlist</title>
        </action>

        <action method="addLink">
          <label>Add to Compare</label>
          <helper>catalog/product_compare</helper>
          <title>Add to Compare</title>
        </action>

      </block>

    </reference>
  </catalog_product_view>
</layout>

Thanks for reading!

Update: Just tested adding a core/text block in the same reference with expected success:

  <block type="core/text" name="testy">
    <action method="setText"><text>hi</text></action>
  </block>

Update 2: Even more intriguing, the block works in local.xml if I change the type to page/template_links (the parent class of my_catalog/addto_links), the block comes into being! Of course, the links are all wrong, because addLink has special powers in my block class. Normally, I'd say that the my_catalog/addto_links piece was wrong, but it works in catalog.xml.

Best Answer

The solution was to change the function name being called from addLink to something else. Even though overriding addLink works fine in catalog.xml, it does not work in local.xml. Can anyone offer insight as to why that's the case?