Answer the question
In order to leave comments, you need to log in
How to properly sort in the News component?
Good afternoon!
Tell me, does the sorting setting in the News component differ from the Catalog component in any way?
Everything in the catalog is without problems, in the News I can’t understand, it doesn’t work.
I read about Sorting here , but it does not come out yet. Sort ordinary elements.
In more detail what I did:
1. Put the code in section.php
<?if (
isset($_GET["sort"]) && isset($_GET["method"]) && (
$_GET["sort"] == "name" ||
$_GET["sort"] == "catalog_PRICE_3" ||
$_GET["sort"] == "property_PRODUCT_TYPE" ||
$_GET["sort"] == "timestamp_x")){
$arParams["ELEMENT_SORT_FIELD"] = $_GET["sort"];
$arParams["ELEMENT_SORT_ORDER"] = $_GET["method"];
}?>
<p class="sort">Сортировка:
<a <?if ($_GET["sort"] == "name"):?> class="active" <?endif;?>
href="<?=$arResult["SECTION_PAGE_URL"]?>?sort=name&method=asc">название</a>
<a <?if ($_GET["sort"] == "catalog_PRICE_3"):?> class="active" <?endif;?>
href="<?=$arResult["SECTION_PAGE_URL"]?>?sort=catalog_PRICE_3&method=asc">цена</a>
<a <?if ($_GET["sort"] == "property_PRODUCT_TYPE"):?> class="active" <?endif;?>
href="<?=$arResult["SECTION_PAGE_URL"]?>?sort=property_PRODUCT_TYPE&method=desc">лидер продаж</a>
<a <?if ($_GET["sort"] == "timestamp_x"):?> class="active" <?endif;?>
href="<?=$arResult["SECTION_PAGE_URL"]?>?sort=timestamp_x&method=desc">дата поступления</a>
</p>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question