3

On my product view page I get the following error:

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

Here's configurable.phtml

<?php
   $_product    = $this->getProduct();
   $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
   $_jsonConfig = $this->getJsonConfig();
   $_renderers = $this->getChild('attr_renderers')->getSortedChildren(); // LINE THE ERROR REFERS TO
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
    <?php
    $_rendered = false;
    foreach ($_renderers as $_rendererName):
        $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
        if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_attribute, $_jsonConfig)):
            $_renderer->setProduct($_product);
            $_renderer->setAttributeObj($_attribute);
            echo $_renderer->toHtml();
            $_rendered = true;
            break;
        endif;
    endforeach;

    if (!$_rendered):
    ?>
    <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
    <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
        <div class="input-box">
            <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                <option><?php echo $this->__('Choose an Option...') ?></option>
              </select>
          </div>
    </dd>
    <?php endif; ?>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
    var spConfig = new Product.Config(<?php echo $_jsonConfig ?>);
</script>
<?php echo $this->getChildHtml('after') ?>

I haven't made any changes to the attributes lately, I only uploaded some swatch images, I've renamed the folder and the code still isn't working

1
  • @KeyurShah sorry I totally forgot about it
    – Eddie
    Commented Jun 2, 2015 at 11:26

1 Answer 1

3

I think you are using custom theme so make sure that in catalog.xml file

in

<PRODUCT_TYPE_configurable translate="label" module="catalog">

under this tag

<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>

this block exist if its not then just add this block under

<PRODUCT_TYPE_configurable>

if its not works then place your catalog.xml here so someone can check

1
  • I checked my catalog.xml and the <PRODUCT_TYPE_configurable translate="label" module="catalog"> block is present in the file. I tried renaming the file in my custom theme so it refers back to the base file, which also has that block in in, but that was no help either
    – Eddie
    Commented May 18, 2015 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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