<?
$arAvailableSort = array(
"name" => Array("name", "asc"),
"price" => Array('catalog_PRICE_'.$arResult['_PRICE_ID'], "asc"),
"date" => Array('PROPERTY_NEWPRODUCT', "desc"),
);
$sort = array_key_exists("sort", $_REQUEST) && array_key_exists(ToLower($_REQUEST["sort"]), $arAvailableSort) ? $arAvailableSort[ToLower($_REQUEST["sort"])][0] : "name";
$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">
<label><?=GetMessage('SECT_SORT_LABEL')?>:</label>
<?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'))?>" class="<?=$className?>" rel="nofollow"><?=GetMessage('SECT_SORT_'.$key)?></a>
<?endforeach;?>
</div>
|