2012-11-04 31 views
0

我最近通過腳本創建了大約700個屬性,所有屬性在後端都很好看。 但是,當我重新索引,我得到以下錯誤:Magento Reindexing不起作用

exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.additional_information_s' in 'field list'' in /lib/Zend/Db/Statement/Pdo.php:228

注:本attribtue存在於數據庫(eav_attribtue)表。

我非常感謝您的建議。

+0

其重新索引到底是什麼?如果產品平坦,請看看這裏:http://stackoverflow.com/questions/12893772/magento-product-attributes-recommended-maximum –

+0

重建索引失敗catalog_fulltextsearch –

+0

因爲,我沒有設置該屬性的後端模型我得到了這樣的reindex失敗錯誤。當我糾正這個問題時,reindex工作得很好。 –

回答

1

以下將重新索引每個索引。

for ($i = 1; $i <= 9; $i++) { 
    $process = Mage::getModel('index/process')->load($i); 
    $process->reindexAll(); 
} 

您還可以使用Magento集合模型來加載每個索引,而不是在for循環中對id進行硬編碼。

/* @var $indexCollection Mage_Index_Model_Resource_Process_Collection */ 
$indexCollection = Mage::getModel('index/process')->getCollection(); 
foreach ($indexCollection as $index) { 
    /* @var $index Mage_Index_Model_Process */ 
    $index->reindexAll(); 
} 

但是如果你想重新索引只是價格的ID爲2

$process = Mage::getModel('index/process')->load(2); 
$process->reindexAll(); 

你也可以調用該函數getProcessByCode如下:

$process = Mage::getModel('index/indexer')->getProcessByCode('catalog_product_price'); 
$process->reindexAll();