【问题标题】:Magento Index Management issues, products not displaying in category pagesMagento 索引管理问题,产品未显示在类别页面中
【发布时间】:2013-04-08 16:32:47
【问题描述】:

这是一个 Magento 问题 - 使用企业版。不幸的是,他们的支持技术人员都在旧金山,而我在英国,所以他们对我的支持仅限于某个时间窗口。

我的类别处于活动状态,设置为显示产品和/或产品和静态块,并且是默认根类别的子类别。

我也有测试产品,它们已启用,有库存,有数量,在目录、搜索中可见,并分配给这些子类别。

问题是,我的测试产品(或任何产品!)没有显示在类别页面上。我使用的是默认/默认主题,并且没有更改 page_layout。

我已清除/刷新所有缓存,并重新建立索引。

但是,我的大多数索引都显示为“已调度”状态并且从未更新过 - 这些索引旁边没有复选框,因此我无法选择它们来“重新索引数据”。

查看截图。

如果有人知道如何解决这个问题,我会很高兴。

谢谢

【问题讨论】:

  • 第一次看到这种东西:(
  • 对索引不太了解,但您的任何自定义扩展都可能处于冲突状态。尝试关闭它

标签: magento indexing product


【解决方案1】:

在前面显示产品时需要重新索引,特别是如果您启用了平面表(管理面板 > 系统 > 配置 > 目录 > 前端:“使用平面目录类别”和“使用平面目录产品”)。

索引的情况有点奇怪。如果您在本地工作站上执行此操作,或者您可以访问主机上的 shell,您可以通过运行以下命令手动强制索引:

pwd$ php shell/indexer.php reindexall

如果您启用了平面表,您可以尝试禁用它们,以检查产品是否会显示在前面。

您还需要对 var 和 media 文件夹及其内容赋予正确的权限。 755应该没问题。

【讨论】:

  • 平面目录类别和使用平面目录产品都设置为“否”,因为它们一直都是。 Var 和 Media 文件夹也设置为 0755。我在这里没有更改任何内容。我正在使用实时登台环境,但我不熟悉 shell 脚本。还是没有运气
【解决方案2】:

这真的很有趣,我最近遇到了一个类似的问题,即重新索引没有完全工作。但是我没有安排显示。

请问您使用的是哪个版本的企业版?

正如 Ventus 建议的一种强制重新索引的久经考验的方法是使用 shell 脚本,为此,您需要通过 SSH 连接到您的服务器。然后使用 cd 命令(更改目录)到您的网站在文件系统上的位置。例如。 cd /var/www/....

从这里运行 php shell/indexer.php reindexall

【讨论】:

    【解决方案3】:
    1. 设置 cron 以运行这将负责重新索引,前提是您没有更改 crontab 值。

    从您的屏幕上看,您似乎从未在此设置上运行过 cron。

    【讨论】:

      【解决方案4】:

      问题解决了。谢谢大家的回答,但以上都不是。

      我错误地安装了产品功能模块。我假设在 app/code/local/... 中开发时,任何不起作用的东西都会退回到 app/code/core/...

      遗憾的是,情况并非如此。我的错,每个人都知道做假设这句话。

      Magento 的学习曲线非常陡峭!

      【讨论】:

      • 我有同样的问题,只有前两个索引状态显示为准备就绪,其余显示为“已调度”。你能给我一些指导你是如何解决这个问题的吗?现在看到所有索引了吗?我使用的是 1.13.0 版本 谢谢
      【解决方案5】:

      将下面的代码放入您的magento安装中的.php文件中,然后从您的URL运行它,这将清理并重新索引所有内容。您可以从 cron 作业中运行它。如果出现任何错误,您的数据库就会出现问题,您应该备份它,然后在新的数据库实例中重新创建它。

          <?php
      
      set_time_limit(0);
      require_once dirname(__FILE__) . '/app/Mage.php';
      
      
      //get all stores
      
      $websites = Mage::app()->getWebsites();
      $thisstore = $websites[1]->getDefaultStore()->getCode();
      
      
      
      echo "Store: ".$thisstore."<br/>";
      
      //clean var dir
      
      $dirs = array(
              'downloader/.cache/*',
              'var/cache/',
              'var/locks/',
              'var/log/',
              'var/report/',
              'var/minifycache/',
              'var/mincache/',
              'var/tmp/'
          );
      
          foreach($dirs as $v => $k) {
              exec('rm -rf '.$k);
          }
      /*
      //clean out sessions
      $dirs = array('var/session/');
      
          foreach($dirs as $v => $k) {
              exec('rm -rf '.$k);
      
          }
      */  
      //clean db log files
      $xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
      $db['host'] = $xml->global->resources->default_setup->connection->host;
      $db['name'] = $xml->global->resources->default_setup->connection->dbname;
      $db['user'] = $xml->global->resources->default_setup->connection->username;
      $db['pass'] = $xml->global->resources->default_setup->connection->password;
      $db['pref'] = $xml->global->resources->db->table_prefix;
      global $db;
      
          $tables = array(
              'catalogsearch_fulltext',
              'dataflow_batch_export',
              'dataflow_batch_import',
              'log_customer',
              'log_quote',
              'log_summary',
              'log_summary_type',
              'log_url',
              'log_url_info',
              'log_visitor',
              'log_visitor_info',
              'log_visitor_online',
              'importexport_importdata',
              'core_url_rewrite',
              'report_viewed_product_index',
              'report_event',
              'core_cache',
              'core_cache_option',
              'core_cache_tag'
          );
      
          mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
          mysql_select_db($db['name']) or die(mysql_error());
      
          foreach($tables as $v => $k) {
              mysql_query('SET FOREIGN_KEY_CHECKS=0; '.'TRUNCATE `'.$db['pref'].$k.'`;'.' SET FOREIGN_KEY_CHECKS=1; ') or die(mysql_error());
          }
      
      ///---------------------------------//
      // now run standard magento cleanup file
      
      
      ## Function to set file permissions to 0644 and folder permissions to 0755
      
      function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
         $d = new RecursiveDirectoryIterator( $dir );
         foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
            if( $path->isDir() ) chmod( $path, $dirModes );
            else if( is_file( $path ) ) chmod( $path, $fileModes );
        }
      }
      
      ## Function to clean out the contents of specified directory
      
      function cleandir($dir) {
      
          if ($handle = opendir($dir)) {
              while (false !== ($file = readdir($handle))) {
                  if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {
                      if (unlink($dir.'/'.$file)) { }
                      else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }
                  }
                  else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {
                      cleandir($dir.'/'.$file);
                      if (rmdir($dir.'/'.$file)) { }
                      else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }
                  }
              }
              closedir($handle);
          }
      
      }
      
      function isDirEmpty($dir){
           return (($files = @scandir($dir)) && count($files) <= 2);
      }
      
      // rebuild everything!!!
      $processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
      $processes->walk('setMode', array(Mage_Index_Model_Process::MODE_REAL_TIME));
      $processes->walk('save');
      
      $processes->walk('reindexAll');
      $processes->walk('reindexEverything');
      
      echo "----------------------- CLEANUP START -------------------------<br/>";
      $start = (float) array_sum(explode(' ',microtime()));
      echo "<br/>*************** SETTING PERMISSIONS ***************<br/>";
      echo "Setting all folder permissions to 755<br/>";
      echo "Setting all file permissions to 644<br/>";
      AllDirChmod( "." );
      echo "Setting pear permissions to 550<br/>";
      
      
      echo "<br/>****************** CLEARING CACHE ******************<br/>";
      
      if (file_exists("var/cache")) {
          echo "Clearing var/cache<br/>";
          cleandir("var/cache");
      }
      
      if (file_exists("var/session")) {
          echo "Clearing var/session<br/>";
          cleandir("var/session");
      }
      
      if (file_exists("var/minifycache")) {
          echo "Clearing var/minifycache<br/>";
          cleandir("var/minifycache");
      }
      
      if (file_exists("downloader/pearlib/cache")) {
          echo "Clearing downloader/pearlib/cache<br/>";
          cleandir("downloader/pearlib/cache");
      }
      
      if (file_exists("downloader/pearlib/download")) {
          echo "Clearing downloader/pearlib/download<br/>";
          cleandir("downloader/pearlib/download");
      }
      
      if (file_exists("downloader/pearlib/pear.ini")) {
          echo "Removing downloader/pearlib/pear.ini<br/>";
          unlink ("downloader/pearlib/pear.ini");
      }
      
      if (file_exists("media/catalog/product/cache/")) {
          echo "Removing media/catalog/product/cache/<br/>";
          unlink ("media/catalog/product/cache/");
      }
      
      if (file_exists("media/tmp/")) {
          echo "Removing media/tmp/<br/>";
          unlink ("media/tmp/");
      }
      date_default_timezone_set("Europe/London");
      echo "Start Cleaning all caches at ... " . date("Y-m-d H:i:s") . "<br/>";
      ini_set("display_errors", 1);
      
      Mage::app('admin')->setUseSessionInUrl(false);
      Mage::getConfig()->init();
      
      $types = Mage::app()->getCacheInstance()->getTypes();
      
      try {
          echo "Cleaning data cache... <br/>";
          flush();
          foreach ($types as $type => $data) {
              echo "Removing $type ... ";
              echo Mage::app()->getCacheInstance()->clean($data["tags"]) ? "[OK]" : "[ERROR]";
              echo "<br/>";
          }
      } catch (exception $e) {
          die("[ERROR:" . $e->getMessage() . "]");
      }
      
      echo "<br/>";
      
      try {
          echo "Cleaning stored cache... ";
          flush();
          echo Mage::app()->getCacheInstance()->clean() ? "[OK]" : "[ERROR]";
          echo "<br/>";
      } catch (exception $e) {
          die("[ERROR:" . $e->getMessage() . "]");
      }
      
      try {
          echo "Cleaning merged JS/CSS...";
          flush();
          Mage::getModel('core/design_package')->cleanMergedJsCss();
          Mage::dispatchEvent('clean_media_cache_after');
          echo "[OK]<br/>";
      } catch (Exception $e) {
          die("[ERROR:" . $e->getMessage() . "]");
      }
      
      try {
          echo "Cleaning image cache... ";
          flush();
          echo Mage::getModel('catalog/product_image')->clearCache();
          echo "[OK]<br/>";
      } catch (exception $e) {
          die("[ERROR:" . $e->getMessage() . "]");
      }
      
      echo "<br/>************** CHECKING FOR EXTENSIONS ***********<br/>";
      If (!isDirEmpty("app/code/local/")) { 
          echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder<br/>";
      }
      If (!isDirEmpty("app/code/community/")) { 
          echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder<br/>";
      }
      $end = (float) array_sum(explode(' ',microtime()));
      echo "<br/>------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------<br/>";
      
      //sitemap refresh
      $collection = Mage::getModel('sitemap/sitemap')->getCollection();
          foreach ($collection as $sitemap) {
              try {
                  $sitemap->generateXml();
              }
              catch (Exception $e) {
                  $errors[] = $e->getMessage();
              }
          }
      
      ?>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-04-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-15
        • 1970-01-01
        相关资源
        最近更新 更多