首页 文章

Magento Index Management发布,产品未显示在类别页面中

提问于
浏览
2

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

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

我还有库存中已启用的测试产品,其数量在目录,搜索中可见,并分配给这些子类别 .

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

我已清除/刷新所有缓存,并重新编制索引 .

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

查看截图 .

Magento - Index Management

如果有人有任何关于如何解决这个问题的线索,我将非常高兴 .

谢谢

5 回答

  • 3
    • 如果没有更改crontab值,设置cron来运行它将负责重建索引 .

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

  • 1

    将此代码放入magento安装中的.php文件中,然后从您的URL运行它,这将清理并重新索引所有内容 . 您可以从cron作业运行它 . 任何错误,那么你在yor数据库中遇到问题,你应该备份它,然后在新的数据库实例中重新创建它 .

    <?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."
    "; //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!
    '; } } else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) { cleandir($dir.'/'.$file); if (rmdir($dir.'/'.$file)) { } else { echo $dir . '/' . $file . ' (directory) NOT deleted!
    '; } } } 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 -------------------------
    "; $start = (float) array_sum(explode(' ',microtime())); echo "
    *************** SETTING PERMISSIONS ***************
    "; echo "Setting all folder permissions to 755
    "; echo "Setting all file permissions to 644
    "; AllDirChmod( "." ); echo "Setting pear permissions to 550
    "; echo "
    ****************** CLEARING CACHE ******************
    "; if (file_exists("var/cache")) { echo "Clearing var/cache
    "; cleandir("var/cache"); } if (file_exists("var/session")) { echo "Clearing var/session
    "; cleandir("var/session"); } if (file_exists("var/minifycache")) { echo "Clearing var/minifycache
    "; cleandir("var/minifycache"); } if (file_exists("downloader/pearlib/cache")) { echo "Clearing downloader/pearlib/cache
    "; cleandir("downloader/pearlib/cache"); } if (file_exists("downloader/pearlib/download")) { echo "Clearing downloader/pearlib/download
    "; cleandir("downloader/pearlib/download"); } if (file_exists("downloader/pearlib/pear.ini")) { echo "Removing downloader/pearlib/pear.ini
    "; unlink ("downloader/pearlib/pear.ini"); } if (file_exists("media/catalog/product/cache/")) { echo "Removing media/catalog/product/cache/
    "; unlink ("media/catalog/product/cache/"); } if (file_exists("media/tmp/")) { echo "Removing media/tmp/
    "; unlink ("media/tmp/"); } date_default_timezone_set("Europe/London"); echo "Start Cleaning all caches at ... " . date("Y-m-d H:i:s") . "
    "; ini_set("display_errors", 1); Mage::app('admin')->setUseSessionInUrl(false); Mage::getConfig()->init(); $types = Mage::app()->getCacheInstance()->getTypes(); try { echo "Cleaning data cache...
    "; flush(); foreach ($types as $type => $data) { echo "Removing $type ... "; echo Mage::app()->getCacheInstance()->clean($data["tags"]) ? "[OK]" : "[ERROR]"; echo "
    "; } } catch (exception $e) { die("[ERROR:" . $e->getMessage() . "]"); } echo "
    "; try { echo "Cleaning stored cache... "; flush(); echo Mage::app()->getCacheInstance()->clean() ? "[OK]" : "[ERROR]"; echo "
    "; } 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]
    "; } catch (Exception $e) { die("[ERROR:" . $e->getMessage() . "]"); } try { echo "Cleaning image cache... "; flush(); echo Mage::getModel('catalog/product_image')->clearCache(); echo "[OK]
    "; } catch (exception $e) { die("[ERROR:" . $e->getMessage() . "]"); } echo "
    ************** CHECKING FOR EXTENSIONS ***********
    "; If (!isDirEmpty("app/code/local/")) { echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder
    "; } If (!isDirEmpty("app/code/community/")) { echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder
    "; } $end = (float) array_sum(explode(' ',microtime())); echo "
    ------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------
    "; //sitemap refresh $collection = Mage::getModel('sitemap/sitemap')->getCollection(); foreach ($collection as $sitemap) { try { $sitemap->generateXml(); } catch (Exception $e) { $errors[] = $e->getMessage(); } } ?>
  • 0

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

    我可以问你使用的是什么版本的企业版?

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

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

  • 0

    Reindex在某种程度上需要在前面显示产品,特别是如果您启用了平面表(管理面板>系统>配置>目录>前端:“使用平面目录类别”和“使用平面目录产品”) .

    索引的情况有点奇怪 . 它是在本地工作站上执行的,或者您可以在托管上访问shell,您可以通过运行此命令手动强制索引:

    pwd$ php shell/indexer.php reindexall

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

    您还需要在var和media文件夹及其内容上设置正确的权限 . 755应该没问题 .

  • 0

    问题解决了 . 谢谢你们的答案,但不是上述情况 .

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

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

    Magento的学习曲线非常陡峭!

相关问题