2

This is a Magento issue - using the Enterprise edition. Unfortunately their support technicians are all in San Francisco, and I am based in the UK, so their support to me is restricted to a certain time window.

I have categories which are active, set to display products, and/or products and static blocks, and are sub categories of the default root category.

I also have test products, which are enabled, in stock, with quantities, visible in Catalog, Search, and are assigned to these sub categories.

The problem is, my test products (or any product!) do not show on the category page. I am using the default/default themes, and have not changed the page_layout.

I have cleared/flushed all caches, and reindexed.

However, most of my indexes appear as status 'SCHEDULED' and have never been updated - there are no checkboxes next to these, so I cannot select them to 'reindex data'.

See the screenshot.

Magento - Index Management

If anyone has any clues on how to fix this, I will be very happy.

Thanks

4

5 回答 5

3

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

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

pwd$ php shell/indexer.php reindexall

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

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

于 2013-04-16T10:17:25.687 回答
1

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

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

可悲的是,情况并非如此。我的错,每个人都知道关于做出假设的短语。

Magento 的学习曲线非常陡峭!

于 2013-04-17T08:36:10.043 回答
0

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

请问你用的是什么版本的Enterprise?

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

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

于 2013-04-16T19:57:28.340 回答
0
  1. 如果您没有更改 crontab 值,则将 cron 设置为运行这将负责重新索引。

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

于 2013-04-16T20:12:19.457 回答
0

将此代码放入您的 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();
        }
    }

?>
于 2013-04-22T10:04:19.043 回答