1

I seem to be having an issues indexing on Magento. All available indexes index fine except for one:

Sm Shopby

When indexing through the following error, but I can't quite see what the issue is.

Sm Shopby index process unknown error:
exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column '`main_table`.`frontend_input`' in 'where clause'' in /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /var/www/vhosts/domain/sub-domain/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/vhosts/domain/sub-domain/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#5 /var/www/vhosts/domain/sub-domain/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#6 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#7 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection/Db.php(740): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#8 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#9 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection/Db.php(572): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#10 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#11 /var/www/vhosts/domain/sub-domain/app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php(29): Varien_Data_Collection->getIterator()
#12 /var/www/vhosts/domain/sub-domain/app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php(20): Sm_Shopby_Model_Resource_Indexer_Attribute->reindexSeoUrlKeys()
#13 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Sm_Shopby_Model_Resource_Indexer_Attribute->reindexAll()
#14 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
#15 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#16 /var/www/vhosts/domain/sub-domain/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
#17 /var/www/vhosts/domain/sub-domain/shell/indexer.php(216): Mage_Shell_Compiler->run()
#18 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column '`main_table`.`frontend_input`' in 'where clause', query was: SELECT `main_table`.*, `additional_table`.* FROM `eav_attribute` AS `main_table`
 INNER JOIN `catalog_eav_attribute` AS `additional_table` ON additional_table.attribute_id = main_table.attribute_id WHERE (`main_table`.`entity_type_id` = '4') AND (```main_table```.```frontend_input``` IN('select', 'multiselect'))' in /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /var/www/vhosts/domain/sub-domain/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/vhosts/domain/sub-domain/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /var/www/vhosts/domain/sub-domain/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /var/www/vhosts/domain/sub-domain/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)
#6 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection/Db.php(740): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)
#7 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
#8 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection/Db.php(572): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
#9 /var/www/vhosts/domain/sub-domain/lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#10 /var/www/vhosts/domain/sub-domain/app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php(29): Varien_Data_Collection->getIterator()
#11 /var/www/vhosts/domain/sub-domain/app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php(20): Sm_Shopby_Model_Resource_Indexer_Attribute->reindexSeoUrlKeys()
#12 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Sm_Shopby_Model_Resource_Indexer_Attribute->reindexAll()
#13 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
#14 /var/www/vhosts/domain/sub-domain/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#15 /var/www/vhosts/domain/sub-domain/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
#16 /var/www/vhosts/domain/sub-domain/shell/indexer.php(216): Mage_Shell_Compiler->run()
#17 {main}

I've looked in the Pdo.php file but I'm not 100% sure what I'm after. I tried a couple of queries which managed to fix Product Flat Data & Category Flat Data, but not this specific index.

Any clues?

  • Magento Could not find colunm name 'frontend_input' in your DB – Vishwas Bhatnagar Nov 16 '15 at 13:43
2

It appears you have installed the latest security patch or are starting from Magento 1.9.2.2?

Notice that the failing query contains duplicate backtick quotes around table alias and field name:

AND (```main_table```.```frontend_input``` IN('select', 'multiselect'))'

It looks like the extension is not compliant with SUPEE-6788.

Fix

Search for calls to addFieldToFilter in the extension code and look for backticks (``) and just remove them in the first function argument.

The call should be somewhere around here or where the collection is built: app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php(29)

Technical Details

The technical details page for SUPEE-6788 at http://magento.com/security/patches/supee-6788-technical-details says:

APPSEC-1063, addressing possible SQL injection

Modules that use SQL statements as field names or escape fields manually will need to be modified.

Developers will need to change the way they generate filters for collections.

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.