0

Search results page on magento showing up blank. HTML ends here:

Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Product_Flat::getEntityTablePrefix() in /home/mysite/public_html/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php on line 510

The line in question is in the magento core files which was probably changed by a bad extension. I have recently tried out a couple of plugins to help with bundle items. I added them manually but they didnt work. Now this happens, I try to remove them manually but it doesnt seem to help. Here's the offending section in Abstract.php - what should it look like?

 /**
     * Get attribute backend table name
     *
     * @return string
     */
    public function getBackendTable()
    {
        if ($this->_dataTable === null) {
            if ($this->isStatic()) {
                $this->_dataTable = $this->getEntityType()->getValueTablePrefix();
            } else {
                $backendTable = trim($this->_getData('backend_table'));
                if (empty($backendTable)) {
                    $entityTable  = array($this->getEntity()->getEntityTablePrefix(), $this->getBackendType());
                    $backendTable = $this->getResource()->getTable($entityTable);
                }
                $this->_dataTable = $backendTable;
            }
        }
        return $this->_dataTable;
    }

This is the offending line:

if (empty($backendTable)) {
                    $entityTable  = array($this->getEntity()->getEntityTablePrefix(), $this->getBackendType());

EDIT: I ran a debug as outlined by the below answer and just got this back:

Fatal error: Class 'Mage_Core_Model_Abstract' not found in .../Abstract.php on line 36

1

Please try to put this code just before the offending call:

if(!is_callable(array($this->getEntity()),'getEntityTablePrefix'))
{
    mageDebugBacktrace();
    //debug_print_backtrace();
    exit;
}

will print out a call-stack that should point the offending code.

It seems that you have an extension and/or customization done that assumes you're not using the flat catalog data tables and wasn't coded to work with the flat table.

Note: Do not make changes in the core files (in your case, app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php). For debugging, you can copy files from core codepool to local and customise.

  • I got this when i ran the copied file on its own with your changes -Fatal error: Class 'Mage_Core_Model_Abstract' not found in /..../Abstract.php on line 36 – Alan BTS Jan 15 '18 at 12:07
  • Are you able to resolve the error now? – Mohit Kumar Arora Jan 15 '18 at 12:26
  • No I dont understand what to do with this information. – Alan BTS Jan 15 '18 at 12:53
  • can you update your question and put the debug info which you have found after putting the code? – Mohit Kumar Arora Jan 15 '18 at 13:04
  • ok thats done now – Alan BTS Jan 15 '18 at 13:58
1

Got help from someone on fiverr.com - he fixed it.

It looks like one of the modules you tried may have switched the catalog from EAV to flat data which is why you were getting the EAV error. By switching to not use flat data in System->Configuration->Catalog->Frontend the search is now working.

  • +1 Well. this solved my issue. – NID Jun 13 at 5:20

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.