Dynamic sorting ubercart products by price use views taxonomy_term

Use hook_views_query_alter(&$view, &$query), formapi create sorting form, Jquery add the on change event to submit the form.
This method can also used in other views sorting.
The hook_views_query_alter
function mymodule_views_query_alter(&$view, &$query) {
$sort_views = array(
‘uc_products’,
‘taxonomy_term’,
);

    if(in_array($view->name, $sort_views) && !drupal_is_front_page()) {
$sorting_criteria = $_SESSION[‘sorting_criteria’];
//  drupal_set_message(t(‘sorting criteria is: ‘.$sorting_criteria));
// drupal_set_message(‘session data of sorting criteria is: ‘. $sorting_criteria);
if(trim($sorting_criteria)) {
$query->orderby = array_merge(array($sorting_criteria), $query->orderby);
}}