I have the following line my configurable.phtml

$_renderers = $this->getChild('attr_renderers')->getSortedChildren()

But this throws the following error:

Call to a member function getChild() on a non-object

When I remove ->getSortedChildren the code works but the default swatches aren't displayed, instead there are dropdowns.

    $_renderers = $this->getChild('attr_renderers')->getSortedChildren();

If I use this nothing is displayed, which means that there are no child objects (I believe)

$_renderers = $this->getChild('attr_renderers'); 

This returns bool(false). How can I fix this that the attribute swatches are displayed again?

  • Have you checked that you have a child block defined in your XML layout update for attr_renderers under your current block? – musicliftsme May 18 '15 at 13:32
  • @musicliftsme i'm not really that familiar with the layout, in what direction should I be looking? – Eddie May 18 '15 at 14:06
  • Are you on CE 1.9 and using rwd? – musicliftsme May 18 '15 at 14:17
  • @musicliftsme CE 1.9 indeed but a custom template but it's very similair to the rwd template – Eddie May 18 '15 at 14:20

It looks like you're using CE 1.9+ (or EE equivalent) and rwd or an inherited package/theme of it. This is happening because $this->getChild('attr_renderers') doesn't return anything. It leads me to believe that your child block attr_renderers is not defined in the layout XML, which should be the the file below, for this page, configurable.phtml. In the original XML file, this is all defined.


Find the section that looks like below and make sure the attr_renderers child block, nested under configurable.phtml, is defined.

<block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml">
    <block type="core/text_list" name="product.info.options.configurable.renderers" as="attr_renderers" />
    <block type="core/text_list" name="product.info.options.configurable.after" as="after" />

Try it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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