S
S
Superhero_a2019-08-15 07:04:59
1C-Bitrix
Superhero_a, 2019-08-15 07:04:59

Is it possible to write two parameters with different values ​​in the url link?

How should the simultaneous action url look like? when we clear the cache, &?clear_cache=Y is added
and if I write this regarding sorting /test2/?sort=new&order=ubiv&?sort=price&order=ubiv then only the 1st part of the sorting is applied and the 2nd is not applied.
ps I customized the Bitrix component and now if I write 2 sorting options on the page in its settings, they are applied, but I need to do this for people, by clicking on a button, for example, "sort by newness and price". I write buttons as usual

<?
$arParams["ELEMENT_SORT_FIELD"] = "catalog_PRICE_1";
$arParams["ELEMENT_SORT_ORDER"] = "DESC";

if ($_GET["sort"] == "price")
{
$arParams["ELEMENT_SORT_FIELD"] = "catalog_PRICE_1";
}
if ($_GET["order"] == "vozvr") $arParams["ELEMENT_SORT_ORDER"]= "asc";
if ($_GET["order"] == "ubiv") $arParams["ELEMENT_SORT_ORDER"]= "desc";

if ($_GET["sort"] == "name")
{
$arParams["ELEMENT_SORT_FIELD"] = "CATALOG_AVAILABLE";
}
if ($_GET["order"] == "vozvr") $arParams["ELEMENT_SORT_ORDER"]= "asc";
if ($_GET["order"] == "ubiv") $arParams["ELEMENT_SORT_ORDER"]= "desc";




if ($_GET["sort"] == "new")
{
$arParams["ELEMENT_SORT_FIELD"] = "property_new";
}

if ($_GET["order"] == "vozvr") $arParams["ELEMENT_SORT_ORDER"]= "asc";
if ($_GET["order"] == "ubiv") $arParams["ELEMENT_SORT_ORDER"]= "desc";
?> 

            <div class="options_catalog">
Сортировать 
<a href="?sort=name&order=desc">Наличие</a>
<a href="?sort=new&order=ubiv">Новинка</a></div>
по цене: <a href="?sort=price&order=ubiv"><img src="/bitrix/templates/.default/components/bitrix/catalog.section.prop/goods3/images/down.png" width="20"></a> <a href="?sort=price&order=vozvr"><img width="20" src="/bitrix/templates/.default/components/bitrix/catalog.section.prop/goods3/images/up.png"></a>
</div>

It turns out to the button "by price" I need this way. is it even possible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Gorbunov, 2019-08-15
@leha_gorbunov

/test2/?sort=new&order=ubiv&?sort=price&order=ubiv
remove the second question mark
like this
/test2/?sort=new&order=ubiv&sort=price&order=ubiv

S
serginhold, 2019-08-15
@serginhold

these are the basics of the basics .. html forms, get-requests ..
it’s not possible like this:
?sort=new&sort=price
is more precisely possible, but one value will overwrite the other
, so you can, for example, like this:
?sort[new]=asc&sort[price]=desc
then in $_GET will be

[
  'sort' => [
    'new' => 'asc',
    'price' => 'desc,
  ],
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question