hook_views_pre_render(&$view) seems to be called after the pager rendering I am designing and ecommerce store and I am trying to sort the products by availability using a hook_view. My function product_eta_seconds return the current eta of a product. Here is my module:

function availability_sort_views_pre_render(&amp;$view) {
  if ('uc_products' == $view-&gt;name &amp;&amp; 'page_1' == $view-&gt;current_display) {

    $view-&gt;result = array_reverse($view-&gt;result);
    $deliveryTime=array();
    foreach ($view-&gt;result as $viewRow){
        $deliveryTime[] = product_eta_seconds($viewRow-&gt;nid);       
    }
    asort($deliveryTime);   
    $view-&gt;result = sortArrayByArray($view-&gt;result,$deliveryTime);
  }
}

function sortArrayByArray($array,$orderArray) {
    $ordered = array();
    foreach($orderArray as $key=&gt;$value) {
        if(array_key_exists($key,$array)) {

                $ordered[$key] = $array[$key];
                unset($array[$key]);
        }
    }
    return $ordered + $array;
}


The problem is the view->result returns only 9 items (my pager value) so when I look at page 2, there are results that should show up on the 1st page (with a lower eta). Is there a solution to get all items of the view without the pager and apply the pager, when the view is rendered ? Any other solution would suit though.
I couldn't find any hook to sort the views result after the results so I ended up using the module "Views PHP" and sort my view using the following:

&lt;?php    
    $deliveryTime1Arr = delivery_time_lookup($row1-&gt;nid);
    $deliveryTimeRow1=$deliveryTime1Arr[3];
    $deliveryTime2Arr = delivery_time_lookup($row2-&gt;nid);
    $deliveryTimeRow2=$deliveryTime2Arr[3];
    if($deliveryTimeRow1&gt;$deliveryTimeRow2) return 1;
    else if($deliveryTimeRow1 == $deliveryTimeRow2) return 0;
    else if($deliveryTimeRow1 &lt; $deliveryTimeRow2) return -1;
?&gt;