【问题标题】:Magento Product Import with Magmi clear cacheMagmi 清除缓存的 Magento 产品导入
【发布时间】:2016-01-15 04:13:08
【问题描述】:

我正在使用 Magmi 7.18 将产品目录导入 Magento。我选择了“动态索引器”,但是在运行导入后,网站前端没有反映正确的信息。我必须通过 Magmi 运行导入,然后进入 Magento 并清除缓存。 Magmi 在运行导入配置文件后是否还没有执行此清除的功能?

【问题讨论】:

    标签: magento magmi


    【解决方案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 根目录中有 n98-magerun。将此放入:plugins/extra/general/clearcache/magmi_clearcache_plugin.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多