Answer the question
In order to leave comments, you need to log in
Different sorting on click?
Good afternoon! Tell me how to make the change of sort values more beautiful when clicking on the link?
<a <? if ($_GET["sort"] == "catalog_PRICE_1"): ?><? endif;?>
href="<?= $arResult["SECTION_PAGE_URL"] ?>?sort=catalog_PRICE_1&method=asc">
<?= Loc::getMessage("PRICE") ?>
</a>
Answer the question
In order to leave comments, you need to log in
1. It is better to replace the href attribute in the link with a bitrix function, this will save other GET parameters, if any
<?=$APPLICATION->GetCurPageParam('sort=указываешь поле для сортировки, в твоем случае catalog_PRICE_1&method=указываешь направление сортировки (ASC, DESC)', array('sort', 'method'))?>
$sort = !empty($_GET['sort']) ? $_GET['sort'] : $arParams['SORT_BY1'];
$method = !empty($_GET['method']) ? $_GET['method'] : $arParams['SORT_ORDER1'];
"SORT_BY1" => $sort,
"SORT_ORDER1" => $method,
"ELEMENT_SORT_FIELD" => $sort,
"ELEMENT_SORT_ORDER" => $method,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question