我使用Magmi 7.18将产品目录导入Magento。我有" On the Fly Indexer"选择,但在运行导入后,网站前端不会反映正确的信息。我必须通过Magmi运行导入,然后进入Magento并清除缓存。 Magmi在运行导入配置文件后是否还没有执行此清除的功能?
答案 0 :(得分:1)
我假设您指的是插件 Magmi Magento Reindexer 。此插件仅更新索引。它根本不会触及缓存。
它基本上只是shell/indexer.php
的包装器。这样做:
php indexer.php reindexall
代码:
$cl = $this->getParam("REINDEX:phpcli") . " shell/indexer.php";
$out = $this->_mdh->exec_cmd($cl, "--reindex $idx", $this->_mdh->getMagentoDir());
创建一个清除缓存的插件也是相当简单的。我在想你可以为n98-magerun写一个包装器。
这样的事情应该有效:
<?php
class Magmi_Clearcache_Plugin extends Magmi_GeneralImportPlugin
{
protected $_mdh;
public function getPluginInfo()
{
return array(
"name" => "n98-magerun cache clear",
"author" => "mblarsen",
"version" => "0.1.0"
);
}
public function afterImport()
{
$this->log("Clearing cache", "info");
$this->clearCache();
return true;
}
public function updateIndexes()
{
$this->log("Clearing cache ....", "info");
$out = $this->_mdh->exec_cmd('n98-magerun', "cache:flush", $this->_mdh->getMagentoDir());
$this->log($out, "info");
$this->log("Done", "info");
}
public function isRunnable()
{
return array(FSHelper::getExecMode() != null,"");
}
public function initialize($params)
{
$magdir = Magmi_Config::getInstance()->getMagentoDir();
$this->_mdh = MagentoDirHandlerFactory::getInstance()->getHandler($magdir);
$this->log("Using execution mode:" . $this->_mdh->getexecmode(), "startup");
}
}
这假设你的magento root目录中有n98-magerun。请放入:plugins/extra/general/clearcache/magmi_clearcache_plugin.php