<?php
/**
 * 
 * 
 * 
 * 
 */

class Hackathon_AsyncIndex_Model_Manager
{

    /**
     * Tells the core indexer to do a partial reindex
     * @param Mage_Index_Model_Process $process
     * @throws Exception
     */
    public function executePartialIndex( Mage_Index_Model_Process $process )
    {
        /** @var $resourceModel Mage_Index_Model_Resource_Process */
        $resourceModel = Mage::getResourceSingleton('index/process');
        $resourceModel->beginTransaction();

        $indexMode = 'schedule';
        $pendingMode = 'pending';

        //Fallback for 1.6.2 installations > Undefined class constant 'MODE_SCHEDULE'
        $refl = new ReflectionClass('Mage_Index_Model_Process');
        if ( in_array('MODE_SCHEDULE', $refl->getConstants() ) )
        {
            $indexMode = Mage_Index_Model_Process::MODE_SCHEDULE;
        }
        if ( in_array('MODE_SCHEDULE', $refl->getConstants() ) )
        {
            $pendingMode = Mage_Index_Model_Process::STATUS_PENDING;
        }

        try
        {
            $process->setMode($indexMode);
            $process->indexEvents();
            if ( count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process)) === 0 ) {
                $process->changeStatus($pendingMode);
            }
            $resourceModel->commit();
        }
        catch (Exception $e)
        {
            $resourceModel->rollBack();
            throw $e;
        }
        
    }
    
} 

<?php
/**
 * 
 * 
 * 
 * 
 */

class Hackathon_AsyncIndex_Model_Manager
{

    /**
     * Tells the core indexer to do a partial reindex
     * @param Mage_Index_Model_Process $process
     * @throws Exception
     */
    public function executePartialIndex( Mage_Index_Model_Process $process )
    {
        /** @var $resourceModel Mage_Index_Model_Resource_Process */
        $resourceModel = Mage::getResourceSingleton('index/process');
        $resourceModel->beginTransaction();

        try
        {
            $process->setMode(Mage_Index_Model_Process::MODE_SCHEDULE);
            $process->indexEvents();
            if ( count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process)) === 0 ) {
                $process->changeStatus(Mage_Index_Model_Process::STATUS_PENDING);
            }
            $resourceModel->commit();
        }
        catch (Exception $e)
        {
            $resourceModel->rollBack();
            throw $e;
        }
        
    }
    
} 

--- 
+++ 
@@ -20,12 +20,26 @@
         $resourceModel = Mage::getResourceSingleton('index/process');
         $resourceModel->beginTransaction();
 
+        $indexMode = 'schedule';
+        $pendingMode = 'pending';
+
+        //Fallback for 1.6.2 installations > Undefined class constant 'MODE_SCHEDULE'
+        $refl = new ReflectionClass('Mage_Index_Model_Process');
+        if ( in_array('MODE_SCHEDULE', $refl->getConstants() ) )
+        {
+            $indexMode = Mage_Index_Model_Process::MODE_SCHEDULE;
+        }
+        if ( in_array('MODE_SCHEDULE', $refl->getConstants() ) )
+        {
+            $pendingMode = Mage_Index_Model_Process::STATUS_PENDING;
+        }
+
         try
         {
-            $process->setMode(Mage_Index_Model_Process::MODE_SCHEDULE);
+            $process->setMode($indexMode);
             $process->indexEvents();
             if ( count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process)) === 0 ) {
-                $process->changeStatus(Mage_Index_Model_Process::STATUS_PENDING);
+                $process->changeStatus($pendingMode);
             }
             $resourceModel->commit();
         }
Fix for Mage 1.6.2 in partial reindex - can't acces class constant there: Undefined class constant 'MODE_SCHEDULE'
