File includes/functions/functions_lookup.php

PHP Code:
/* 
 *  return attributes products_options_sort_order 
 *  TABLES: PRODUCTS_OPTIONS, PRODUCTS_ATTRIBUTES 
 */ 
  
function zen_get_attributes_options_sort_order($products_id$options_id$options_values_id) { 
    global 
$db
      
$check $db->Execute("select products_options_sort_order 
                             from " 
TABLE_PRODUCTS_OPTIONS 
                             where products_options_id = '" 
. (int)$options_id "' limit 1"); 
 
      
$check_options_id $db->Execute("select products_id, options_id, options_values_id, products_options_sort_order 
                             from " 
TABLE_PRODUCTS_ATTRIBUTES 
                             where products_id='" 
. (int)$products_id "' 
                             and options_id='" 
. (int)$options_id "' 
                             and options_values_id = '" 
. (int)$options_values_id "' limit 1"); 
 
 
      return 
$check->fields['products_options_sort_order'] . '.' str_pad($check_options_id->fields['products_options_sort_order'],5,'0',STR_PAD_LEFT); 
  } 
We can have different sort order for different languages for the same product option, but first query do not filter result by language_id, it just takes first record. Resulting sort order may be different from what we are expecting.

We need to pass $_SESSION['languages_id'] additionally or use it right here in function.