1

The line $productAttribute->getSource() in app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php throws an error: Call to a member function getSource() on a non-object

This is the concerning function

foreach ($attributes as $attribute) {
    $productAttribute = $attribute->getProductAttribute();
    $productAttribute->getSource();
    $this->addColumn($productAttribute->getAttributeCode(), array(
        'header'    => $productAttribute->getFrontend()->getLabel(),
        'index'     => $productAttribute->getAttributeCode(),
        'type'      => $productAttribute->getSourceModel() ? 'options' : 'number',
        'options'   => $productAttribute->getSourceModel() ? $this->getOptions($attribute) : ''
    ));
}

I assume a certain attribute didn't get created and this is causing the issue. But how can I debug it, find out which attribute is causing the issue? I tried to var_dump $attributes and $productAttribute but that results in a blank page. Nothing in log files.

Thanks!

1 Answer 1

1

You can do the following:

foreach ($attributes as $attribute) {

    $productAttribute = $attribute->getProductAttribute();

    if(!is_object($productAttribute))
       Mage::log($productAttribute->getAttributeCode());

    $productAttribute->getSource();
    ...
}

And then check your log file to see which one is causing the error.

Your Answer

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

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