Magento Reindexing不起作用

时间:2012-11-04 16:58:32

标签: magento reindex

我最近通过脚本创建了大约700个属性,所有属性在后端都很好看。 但是当我重新索引时,我得到以下错误:

  

异常'PDOException',消息'SQLSTATE [42S22]:列不是   发现:1054'字段中的未知列'e.additional_information_s'   列表''在/lib/Zend/Db/Statement/Pdo.php:228

注意:此属性存在于Database(eav_attribtue)表中。

我非常感谢你的建议。

1 个答案:

答案 0 :(得分: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();