B
B
bichukov2022-03-25 10:11:17
1C-Bitrix
bichukov, 2022-03-25 10:11:17

How to make multiple selection by filters (buttons) via get requests?

Hello, I have this code:

global $arrFilter;
        $arrFilter = array(
            "IBLOCK_ID" => "7",
        );
        $arPropertyFilter = array(
            "LOGIC" => "OR"
        );
        if($_GET['filter_hit'] == 'Y'){
            $arPropertyFilter[] = array("PROPERTY_YAVLYAETSI_VALUE" => "популярным");
        }
        if($_GET['filter_new'] == 'Y'){
            $arPropertyFilter[] = array("PROPERTY_YAVLYAETSI_VALUE" => "новинкой");
        }
        if($_GET['filter_sale'] == 'Y'){
            $arPropertyFilter[] = array("PROPERTY_YAVLYAETSI_VALUE" => "акцией");
        }
        $arrFilter[] = $arPropertyFilter;


switch ($_GET["filter_hit"]) {
            case "new":
                $arParams["FILTER_NAME"]= $arrFilter;
                break;
            case "hit":
                $arParams["FILTER_NAME"]= $arrFilter;
                break;
            case "sale":
                $arParams["FILTER_NAME"]= $arrFilter;
                break;

        }

        ?>

        <?
        if ($_GET["filter_new"]=='Y')
        {
         $href='/catalog';
        }
        elseif($_GET["filter_new"]!=='')
        {
            $href='?filter_new=Y';
        }

        ?>
        <?
        if ($_GET["filter_hit"]=='Y')
        {
         $href1='/catalog';
        }
        elseif($_GET["filter_hit"]!=='')
        {
            $href1='?filter_hit=Y';
        }

        ?>
        <?
        if ($_GET["filter_sale"]=='Y')
        {
         $href2='/catalog';
       }
        elseif($_GET["filter_sale"]!=='')
        {
           $href2='?filter_sale=Y';
        }


Here there is a filtering on 3 buttons separately. But you need to make it possible to filter (ie, to be pressed) 2-3 buttons at the same time.
No matter how hard I tried, I came up with nothing.
If there are any options I would be grateful)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question