Problem z indeksowaniem pojawił się przy ok 5000 produktów.
Aktualnie mam ok 11 tys. produktów
Kwestie rozwiązałem poprzez wywoływanie re-indeksacji z crona za pomocą poniższego skryptu:
#!/usr/local/php5/bin/php -q
<?php
require './app/Mage.php';
Mage::app('admin');
Mage::setIsDeveloperMode(true);
if (!Mage::app()->isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit(1);
}
// Only for urls
// Don't remove this
$_SERVER['SCRIPT_FILENAME'] = 'index.php';
try
{
// CLEAN CACHE
Mage::app()->cleanCache();
echo 'Cleared all caches' . "\n";
// CATALOG REWRITES
try {
Mage::getSingleton('catalog/url')->refreshRewrites();
echo 'Catalog Rewrites were refreshed successfully' . "\n";
}
catch (Mage_Core_Exception $e) {
echo $e->getMessage() . "\n";
}
catch (Exception $e) {
echo 'Error while refreshed Catalog Rewrites. Please try again later' . "\n";
}
// IMAGE CACHE
/* try {
Mage::getModel('catalog/product_image')->clearCache();
echo 'Image cache was cleared succesfuly' . "\n";
}
catch (Mage_Core_Exception $e) {
echo $e->getMessage() . "\n";
}
catch (Exception $e) {
echo 'Error while cleared Image cache. Please try again later' . "\n";
} */
// LAYERED NAV
try {
$flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
if ($flag->getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING) {
$kill = Mage::getModel('catalogindex/catalog_index_kill_flag')->loadSelf();
$kill->setFlagData($flag->getFlagData())->save();
}
$flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save();
Mage::getSingleton('catalogindex/indexer')->plainReindex();
echo 'Layered Navigation Indices were refreshed successfully' . "\n";
}
catch (Mage_Core_Exception $e) {
echo $e->getMessage() . "\n";
}
catch (Exception $e) {
echo 'Error while refreshed Layered Navigation Indices. Please try again later' . "\n";
}
//Calatog Index
// try {
// Mage :: getResourceModel( 'catalog/category_flat' ) -> rebuild();
// echo 'Flat Category Index refreshed successfully' . "\n";
// }
// catch ( Exception $e ) {
// echo 'ERROR Flat Category Index' . "\n";
// }
// try {
// Mage :: getResourceModel( 'catalog/product_flat_indexer' ) -> rebuild();
// echo 'Flat Products Index were refreshed successfully' . "\n";
// }
// catch ( Exception $e ) {
// echo 'ERROR Flat Products Index' . "\n";
// } */
try {
Mage :: getSingleton( 'catalog/index' ) -> rebuild();
echo 'Catalog Index were refreshed successfully' . "\n";
}
catch ( Exception $e ) {
echo 'ERROR Catalog Index' . "\n";
}
// SEARCH INDEX
try {
Mage::getSingleton('catalogsearch/fulltext')->rebuildIndex();
echo 'Search Index was rebuilded successfully' . "\n";
}
catch (Mage_Core_Exception $e) {
echo $e->getMessage() . "\n";
}
catch (Exception $e) {
echo 'Error while rebuilded Search Index. Please try again later' . "\n";
}
// STOCK STATUS
try {
Mage::getSingleton('cataloginventory/stock_status')->rebuild();
echo 'CatalogInventory Stock Status was rebuilded successfully' . "\n";
}
catch (Mage_Core_Exception $e) {
echo $e->getMessage() . "\n";
}
catch (Exception $e) {
echo 'Error while rebuilded CatalogInventory Stock Status. Please try again later' . "\n";
}
// CLEAN CACHE
Mage::app()->cleanCache();
echo 'Cleared all caches' . "\n";
echo "\n" . 'Cache clear complete!' . "\n";
exit(0);
}
catch (Exception $e) {
Mage::printException($e);
}
exit(1);
?>
Wywołanie go w CRON powoduje odbudowanie cache i wszystkich indeksów w magento.
Niestety odbudowa nawigacji wywoływana przez magento nie zawsze kończy się sukcesem , co powodowało problemy z uszkodzona nawigacją warstwową