0

I'm getting an error when I try to go to Catalog -> Manage Products in the backend. I'm using Magento ver 1.8.1.0.

I think I may have screwed up the database when I was trying to import some products. I'm wondering how I can make it go back to normal. I've tried removing all products using this stackoverflow answer but I still get the same error.

Invalid attribute type

#0 /usr/share/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(652): Mage::exception('Mage_Eav', 'Invalid attribu...')
#1 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php(119): Mage_Eav_Model_Entity_Collection_Abstract->joinAttribute('status', 'catalog_product...', 'entity_id', NULL, 'inner')
#2 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): Mage_Adminhtml_Block_Catalog_Product_Grid->_prepareCollection()
#3 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#4 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#5 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#6 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('grid', true)
#7 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php(79): Mage_Core_Block_Abstract->getChildHtml('grid')
#8 /usr/share/magento/app/design/adminhtml/default/default/template/catalog/product.phtml(46): Mage_Adminhtml_Block_Catalog_Product->getGridHtml()
#9 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/usr/share/mage...')
#10 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#11 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#13 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template->_toHtml()
#14 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Widget_Container->_toHtml()
#15 /usr/share/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#16 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#17 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#18 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#19 /usr/share/magento/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
#20 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/usr/share/mage...')
#21 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#22 /usr/share/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#23 /usr/share/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#24 /usr/share/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml()
#25 /usr/share/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#26 /usr/share/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#27 /usr/share/magento/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(180): Mage_Core_Controller_Varien_Action->renderLayout()
#28 /usr/share/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->indexAction()
#29 /usr/share/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#30 /usr/share/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#31 /usr/share/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#32 /usr/share/magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#33 /usr/share/magento/index.php(87): Mage::run('', 'store')
#34 {main}

1 Answer 1

1

If you have XDebug then this would be an easy one to troubleshoot. I'm assuming you don't or you wouldn't be asking your question.

One way you could possibly find out which attribute is causing the problem involves adding a Mage::log() entry in a core file.

Note to everyone else reading this: I know this isn't the "right" way to do it but if someone doesn't have a IDE and debugger then this is the best I can think of under the circumstances.

In app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php it's hitting an exception indicating that an attribute is invalid.

    // validate attribute
    if (is_string($attribute)) {
        $attribute = $entity->getAttribute($attribute);
    }
    if (!$attribute) {
        throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute type'));
    }

Just to determine exactly which attribute this is having a problem with, you should turn on the system.log and add a line in that file temporarily.

In that file around line 652, add the following code:

    // validate attribute

    Mage::log("Attribute: " . $attribute); // <-- new line

    if (is_string($attribute)) {
        $attribute = $entity->getAttribute($attribute);
    }
    if (!$attribute) {
        throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute type'));
    }

Go to your admin and open Manage Products. When you get the Exception message, go to var/log/system.log and look for the last entry that has Attribute: in it.

After your determine the attribute name that it has a problem with, undo the core hack. Go to "Manage Attributes" to see if that attribute is listed. If so, then delete it from there and re-index your site.

8
  • Thanks for your help! I'll definitely look into setting up XDebug to make debugging easier. The system.log file says: DEBUG (7): Attribute: status. However, I don't see that attribute listed under Manage Attributes. Is there an easy way to delete all attributes and restore to the default ones? Commented Jan 31, 2015 at 21:29
  • You don't see "status" in your Attributes? Commented Jan 31, 2015 at 21:42
  • If you followed the direct SQL delete advice in that other answer then you may have inadvertently corrupted your install. If you're missing status then you may be missing other system attributes. Do you have any orders or customers in the system? How big of a loss of time would it be if you just re-installed from scratch? :) Commented Jan 31, 2015 at 21:48
  • It seems to me you removed the EAV attribute, status. You can quickly check by going into the eav_attribute table or the admin's attribute seciton and look for status to verify.
    – laketuna
    Commented Jan 31, 2015 at 23:35
  • @laketuna, yes that was already mentioned above. Commented Jan 31, 2015 at 23:48

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.