我似乎在Magento上有索引问题.所有可用的索引索引都很好,除了一个:
Sm Shopby
通过以下错误编制索引时,我无法完全看出问题所在.
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}
Run Code Online (Sandbox Code Playgroud)
我查看过Pdo.php文件,但我并不是100%肯定我在追求什么.我尝试了几个查询,设法修复了产品平面数据和类别平面数据,但没有设置这个特定的索引.
有线索吗?
谢谢.
小智 8
n也是这个问题.我把它缩小到了Attribute.php的问题.打开app/code/local/Sm/Shopby/Model/Resource/Indexer/Attribute.php
在第65行附近,您将找到名为_getAttribute的受保护函数.改变一下,
protected function _getAttributes($attributeId = null){
$collection = Mage::getSingleton('eav/config')
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
->getAttributeCollection()
->addFieldToFilter('`main_table`.`frontend_input`', array('in' => array('select', 'multiselect')));
if (!empty($attributeId)) {
$collection->addFieldToFilter('`main_table`.`attribute_id`', $attributeId);
}
return $collection;
}
Run Code Online (Sandbox Code Playgroud)
改为这个代码,
protected function _getAttributes($attributeId = null){
$collection = Mage::getSingleton('eav/config')
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
->getAttributeCollection()
->addFieldToFilter('main_table.frontend_input', array('in' => array('select', 'multiselect')));
if (!empty($attributeId)) {
$collection->addFieldToFilter('main_table.attribute_id', $attributeId);
}
return $collection;
}
Run Code Online (Sandbox Code Playgroud)
改变了什么?我唯一改变的是删除第69和71行的撇号(').这意味着'main_table'.'frontend_input'现在变为main_table.frontend_input.现在脚本正确地更新了SQL.在Admin和Shell中都有.
同样的问题,现在解决了.
该列'main_table.frontend_input'存在,但'`main_table`.`frontend_input`'(在SQL查询转换为```main_table```.```frontend_input```)中不存在.
只需转到Sm_Shopby_Model_Resource_Indexer_Attribute并删除即可 `
更新:Sm_Shopby_Model_Resource_Indexer_Attribute是一个SM Shopby扩展的类.
该文件保留在magento_folder/app/code/... /Sm/Shopby/Model/Resource/Indexer/Attribute.php中,要更改的函数是_getAttributes.