Magento安装demo数据后,要进入后台手动进行重新索引后,在前台才能正常看到分类和产品,这个问题让新手非常困惑,甚至会认为是安装的时候出错了。为了解决问题,可以在安装向导里增加自动建立索引功能,这样安装好demo数据后就能在前台正常查看分类和产品了。在安装向导增加自动建立索引功能的代码如下:
首先找到core/Mage/Install/controllers/WizardController.php文件,然后再找public function administratorPostAction(),在这个function 里找到
try {
$this->_getInstaller()->createAdministrator($user);
$this->_getInstaller()->installEnryptionKey($encryptionKey);
在$this->_getInstaller()->installEnryptionKey($encryptionKey);下面加
$allIndexs=Mage::getSingleton(‘index/indexer’)->getProcessesCollection();
foreach($allIndexs as $index)
{
$index->reindexEverything();
}
OK,保存即可,就这么简单。(责任编辑:最模板)