Get view result with sorting option programmattically
You could check this sample code. It contains additional methods in Views that you could use like in the line:

//Here we can alter the order
//$view-&gt;set_item('default', 'sort', 'random', NULL);
if(isset($alter['node_created_order'])){
  $view-&gt;add_item('default', 'sort', 'node', 'created',array('order' =&gt; $alter['node_created_order']));
}