<?
$arAvailableSort = array(
"name" => Array("name", "asc"),
"price" => Array('catalog_PRICE_'.$arResult['_PRICE_ID'], "asc"),
"quantity" => Array("CATALOG_QUANTITY", "desc"),
);
$sort = array_key_exists("sort", $_REQUEST) && array_key_exists(ToLower($_REQUEST["sort"]), $arAvailableSort) ? $arAvailableSort[ToLower($_REQUEST["sort"])][0] : "CATALOG_QUANTITY";
$sort_order = array_key_exists("order", $_REQUEST) && in_array(ToLower($_REQUEST["order"]), Array("asc", "desc")) ? ToLower($_REQUEST["order"]) : $arAvailableSort[$sort][1];
?>
<div class="catalog-item-sorting"><span><?=GetMessage('SECT_SORT_LABEL')?>:</span><?foreach ($arAvailableSort as $key => $val):
$className = $sort == $val[0] ? 'selected' : '';
if ($className)
$className .= $sort_order == 'asc' ? ' asc' : ' desc';
$newSort = $sort == $val[0] ? $sort_order == 'desc' ? 'asc' : 'desc' : $arAvailableSort[$key][1];
?><a href="<?=$APPLICATION->GetCurPageParam('sort='.$key.'&order='.$newSort, array('sort', 'order'))?>" id="sort-sort-<?=$key?>" class="<?=$className?>" rel="nofollow"><?=GetMessage('SECT_SORT_'.$key)?></a><?endforeach;?>
</div>
|