0

I was about to roll out a new module, and I started getting this error on the front end. Products will not display. They show the product name, then the page rendering fails and the error message appears:

Fatal error: Call to a member function getSummaryHtml() on a non-object in /usr/local/apache2/htdocs/app/code/core/Mage/Catalog/Block/Product/Abstract.php on line 314

This function in the Magento Core library is as follows:

 public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false,
    $displayIfNoReviews = false)
{
    if ($this->_initReviewsHelperBlock()) {
        return $this->_reviewsHelperBlock->getSummaryHtml($product, $templateType, $displayIfNoReviews);
    }

    return '';
}

Line 314 is the ' return $this->... ' statement.

If I comment out this line, the site appears to run fine.

My scripts perform product price and other attribute updates. It also adds products if they are not found in the database. My concern is that my import script isn't updating part of the product model correctly, and creating this error.

My module is built in /app/code/local, and deals exclusively with the backend. I dropped the entire database and restored it to a known-to-be-solid version. Therefore, I believe I may have accidentally deleted a file or in some way changed Magento's core functionality. This is on the dev server. On the live server, the same database runs just fine.

Everything was fine, the only recent files that I removed were in my custom module's specific design and code directories.

I have cleared the caches, reindexed everything, dropped the database and restored a known working version, the only thing left seems to be the codebase is somehow changed.

I am about to roll out my admin module, but I do not want to do that until I know what is wrong here. Commenting out a line of Magento Core code on my live server seems like a hack fix.

David Manners
  • 27,241
  • 9
  • 76
  • 220
BMcNamara
  • 35
  • 5
  • Does your import script deal with product reviews? If not, I don't see why it would be to blame. – Julien Lachal Jan 16 '15 at 16:05
  • It does not touch product reviews at all. When I update a product, or add a product, I do not touch reviews. – BMcNamara Jan 16 '15 at 16:09
  • Are you using import from external DB? Maybe some value has been imported/filled into wrong field on products table? – versedi Jan 16 '15 at 16:41
  • I am importing via csv. I use the Magento product model to do all updates and saves. Besides, I dropped the db and restored the production website's db, which has no issues, and the problem persists. That is why I'm thinking it has something to do with the Magento files. For the life of me, I cannot think of any changes to the codebase. I have limited all of my work to my custom module in the /code/local path. – BMcNamara Jan 16 '15 at 17:11

1 Answers1

1

So the reason that the error occurs is because Magento cannot load the block for the review systen. The block should be found at Mage_Review_Block_Helper and is instantiated with the call to $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');

What I recommend here is to go into the code at this point. Mage_Catalog_Block_Product_Abstract line 347 and add some debugging to see why this block is not being created.

You can also check Fundamentals for debugging a Magento store for some more help with debugging Magento.

David Manners
  • 27,241
  • 9
  • 76
  • 220