0

I'm trying to display my attributes on the product view page, it worked fine at first but suddenly it stopped working and I get the following error:

Call to a member function getSortedChildren() on a non-object in /template/catalog/product/view/type/options/configurable.phtml on line 32

When I look in the file on line 32 I find the following:

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

How can I fix this problem?

0

Just an other "feature" of the rwd theme.
I assume you built your theme based on the rwd theme.
Make sure you have this in your catalog.xml layout file of your theme inside the layout handle <PRODUCT_TYPE_configurable>

    <reference name="product.info.options.wrapper">
        <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" />
        </block>
    </reference>

If that does not work , copy the file suggested in the error message to your theme and replace this:

    foreach ($_renderers as $_rendererName):
        $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
        if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_product, $_attribute, $_jsonConfig)):
            $_renderer->setProduct($_product);
            $_renderer->setAttributeObj($_attribute);
            echo $_renderer->toHtml();
            $_rendered = true;
            break;
        endif;
    endforeach;

with this:

    $attRenderes = $this->getChild('attr_renderers');
    if ($attRenderes) : 
        foreach ($_renderers as $_rendererName):

            $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
            if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_product, $_attribute, $_jsonConfig)):
                $_renderer->setProduct($_product);
                $_renderer->setAttributeObj($_attribute);
                echo $_renderer->toHtml();
                $_rendered = true;
                break;
            endif;
        endforeach;
     endif;

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.