2015-11-16 45 views
0

我似乎在Magento上有索引問題。所有可用的指標指數精細,除了一個:Sm Shopby無法初始化Reindexer流程

釤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} 

我看了在Pdo.php文件,但我敢肯定,我後不是100%。我嘗試了幾個查詢設法修復產品平面數據&類別平面數據,但不是這個特定的索引。

任何線索?

謝謝。

回答

7

同樣的問題,現在解決。

'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。

+0

你好,謝謝你的回覆。查看數據庫,表:Sm_Shopby_Model_Resource_Indexer_Attribute不存在。我也嘗試刪除調用'addFieldToFilter'的'Attribute.php'文件中的反引號。任何其他想法?謝謝。 –

+0

對不起,沒有指定,這(Sm_Shopby_Model_Resource_Indexer_Attribute)不是一個表,而是一個擴展類。 magento_folder/app/code/... /Sm/Shopby/Model/Resource/Indexer/Attribute.php - > function _getAttributes – lino4000

6

n也納入此確切問題。我縮小了Attribute.php的問題。 打開應用/代碼/本地/ Sm/Shopby /型號/資源/索引器/ 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; 
    } 

這個代碼,而不是,

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; 
    } 

是什麼改變了? 我改變的唯一的事情是刪除第69和71行的撇號(')。這意味着'main_table'.'frontend_input'現在變成了main_table.frontend_input。現在這些腳本正確更新SQL。無論是在管理員和殼牌。