$sql = "select count(*) as total
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
where patrib.products_id='" . (int)$_GET['products_id'] . "'
and patrib.options_id = popt.products_options_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
" limit 1";
$pr_attr = $db->Execute($sql);
if ($pr_attr->fields['total'] > 0) {
if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
$options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0")';
} else {
$options_order_by= ' order by popt.products_options_name';
}
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
popt.products_options_type, popt.products_options_length, popt.products_options_comment,
popt.products_options_size,
popt.products_options_images_per_row,
popt.products_options_images_style,
popt.products_options_rows
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
where patrib.products_id='" . (int)$_GET['products_id'] . "'
and patrib.options_id = popt.products_options_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$options_order_by;
$sql = "select count(*) as total
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
where patrib.products_id='" . (int)$_GET['products_id'] . "'
and patrib.attributes_display_only = 0
and patrib.options_id = popt.products_options_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
" limit 1";
$pr_attr = $db->Execute($sql);
if ($pr_attr->fields['total'] > 0) {
if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
$options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0")';
} else {
$options_order_by= ' order by popt.products_options_name';
}
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
popt.products_options_type, popt.products_options_length, popt.products_options_comment,
popt.products_options_size,
popt.products_options_images_per_row,
popt.products_options_images_style,
popt.products_options_rows
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
where patrib.products_id='" . (int)$_GET['products_id'] . "'
and patrib.attributes_display_only = 0
and patrib.options_id = popt.products_options_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$options_order_by;