Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How can I change the query args in the url

Viewing 10 posts - 1 through 10 (of 16 total)
  • Lisa Kriga
    #189626

    Hi,

    We have two forms for filtering our products, one of which is a tool for to help our customers choose the right product based on a lot of data.

    It is quite complicated, but simply put they (among other simpler choises) choose a reference wind (22/23/24/24/26) and terrain class (1/2/3), and then in two range sliders they choose wind surface range (0-3) and weight range (0-300). Based on the chosen reference wind and terrain class I want the products that have values (in the corresponding meta box) within the chosen range to be displayed.

    In the range sliders I only have values from one meta box (since I can’t add multiple), just to get the input objects in the form, so I made a function that I added with filter ‘sf_edit_query_args’ to change the meta query according to my wishes.

    The meta query is changed as expected, but the result does not take the meta_query in consideration. It is showing the result based on the query in the url (&_sfm_prefix_ws_24_type_2=0+3&_sfm_prefix_weight_24_type_2=0+300 as default for these inputs).

    I have tried using the filter ‘sf_results_url’ to remove them, but $url only returns the url without query args.

    Is there any way to alter the url? Or any other way I could pull this off?

    Kind Regards
    Lisa Kriga

    Trevor Moderator
    #189629

    If I understand the question correctly, you have one field on the form that represents more than set/type of data. Is that correct?

    Lisa Kriga
    #189743
    This reply has been marked as private.
    Lisa Kriga
    #189745

    It was supposed to say: This is my code:

    The meta-query is added as it should, but no changes in the results are made. (If the query was all wrong then at least there should be no result at all?)

    Trevor Moderator
    #189778

    After you change the URL, somehow you would need to get the results to reload. I am not sure that can be done.

    All this data is being stored in one meta field. I am not sure if it would work as separate meta fields (and thus separate sliders) either, if I understand that each post would have one set of data, and splitting it up would leave empty values in the other fields, which would cause the posts not to show in a search. If they had 0 in the other fields, that might work.

    Lisa Kriga
    #189780

    Depending on which values are chosen in the inputs for rw (22-26) and tc (1-3) the corresponding ws and fw-value is used in the sliders. That is, if I choose 22 as rw and 1 as tc then the values in those meta boxes for ws and fw are compared to the data chosen in the rangers (ws-22-1 and rw-22-1), so I basically would need a conditional range slider which is not available.

    The code above is used with “sf_edit_query_args”. (I have asdo tried using “sf_results_url” as mentioned in the first text, but that didn’t work since it only gets me the base-url.)

    But if this is not the way to use the filter, how is it suppose to work? I thought the filter “sf_edit_query_args” would alter the query for the search, what does it do then? Just in case that will give me some new idea on how to advance.

    Otherwise I’ll just have to figure out a way to update the search query ’cause this is an important feature of this filter.

    Trevor Moderator
    #189786
    This reply has been marked as private.
    Lisa Kriga
    #189794
    This reply has been marked as private.
    Trevor Moderator
    #189802
    This reply has been marked as private.
    Lisa Kriga
    #191728
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 16 total)

The topic ‘How can I change the query args in the url’ is closed to new replies.