Skip Navigation

[Closed] problem with custom search when results in other page

This support ticket is created 7 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.02 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 7 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#414809

I am trying to:
I've created a custom search in which the search appears on one page and the results in another page. on the results page' - I also have a search.
The view that displays the search filter has a custom JS code that shows the related filters by identifying the chosen parameter from a custom field select box.
for example: if a person chose in the select box "category1"- then he will see the relevant fields for that category.

this is the code:

jQuery(document).ready(function($){
$('div[id^="group"]').hide();
$('#wpv_control_select_listing-category').change(function() {
$('div[id^="group"]').hide();
var div_id = 'group'+$('#wpv_control_select_listing-category').val();
$('div[id="'+div_id+'"]').show();
});
});

the problem is that when a person gets the results page- he doesn't see the relevant fields. he does see that in the custom field of the select box the relevant category is marked. but the relevant fields doesn't appear. in order to see them- he needs to choose another category and that switch back to the relevant one.....

I expected to see: when a person searches on the search page- he will be transfer to the results page. there he will see an extended search in which the relevant filters appear by the specific chosen category from a custom field of a select box. by switching to another category- the filters will change to the relevant filters.

Instead, I got: i get the results page, but the relevant filters doesn't appear.

#414919

Dear Shirly,

I suggest you try with Views shortcode [wpv-conditional] to check the [wpv-search-term] (URL parameter) value, and display what you need, more help:
https://toolset.com/documentation/views-shortcodes/#wpv-conditional
Conditional shortcode to be used to display a specific block of meta HTML based on results of a boolean expression . If the expression is true, then the meta HTML between the [wpv-conditional][/wpv-conditional] shortcodes will be executed.
https://toolset.com/documentation/views-shortcodes/#wpv-search-term
This shortcode displays the search term when visiting the search results page

#423317

hey, thank you for the answer.
i've used a wpv-conditional shortcode. i've created a condition according when someone select a category from a selectbox (listing-category) - the other fields will change and he will see only specific fields related to the selectbox.
but i have 2 problems:
1. when i change the category on the select-box that i've define as a trigger for the condition- it does'nt change the fields in the search at all.

2. the search results doesn't change according to the new selected category.

[wpv-filter-start hide="false"]
[wpv-filter-controls]



<div class="container-fluid full search-page-box" >

  <div class="row" style="margin: 0px 40px 40px 40px;">

    <!-- search-box -->
    <br>
    [wpv-filter-search-box]	

    [wpv-control field="listing-address" url_param="listing-address"]

    [wpv-control id="listing-category" field="listing-category" url_param="listing-category" type="select"  auto_fill_sort="asc"]<br>

    <div class="row">
   
      <div class="col-md-6">
      [wpv-filter-submit name="Search" class="btn btn-default btn-lg btn-block" style="border-radius:5px;" type="button"]
    </div>
    <div class="col-md-6">
      [wpv-filter-reset reset_label="Reset" class="btn btn-default btn-lg btn-block" style="border-radius:5px;" type="button"] 
    </div>
      </div>

    <div align="center" style="margin-top: 20px;">
      <a href="<em><u>hidden link</u></em>" style="border-radius: 5px;color: white;background-color: rgb(175, 206, 248);border-color: rgb(175, 206, 248);padding: 10px 20px 10px 20px;font-size: large;">Add new</a>
    </div>

  </div>
  <hr>

  <div style="margin-left: 25%;"><!-- filters -->
 


    <!-- specific category filter -->

[wpv-conditional if="( $(wpcf-listing-category) eq '3' )"]
    <!-- sportcenter  -->
    <!-- specific category filter -->
    <div id="group3">
      [wpml-string context="wpv-views"]<br><b>sport-center services</b><br><br>[/wpml-string] [wpv-control field="sport-center-services" url_param="sport-center-services"]

    </div>

    <!-- end sport center  -->  
[/wpv-conditional]


[wpv-conditional if="( $(wpcf-listing-category) eq '5' )"]
    <!-- Groceries store  -->
    <!-- specific category filter -->
    <div id="group5">
      [wpml-string context="wpv-views"]<br><b>Groceries store services</b><br><br>[/wpml-string] [wpv-control field="groceries-store-services" url_param="groceries-store-services"]
    </div>

    <!-- specific category filter -->
    <div id="group5">
      [wpml-string context="wpv-views"]<br><b>Groceries store types</b><br><br>[/wpml-string] [wpv-control field="groceries-store-types" url_param="groceries-store-types"]
    </div>

    <!-- end Groceries store  -->  
[/wpv-conditional]



  </div><!-- end filters -->




</div>
<br><br>
[/wpv-filter-controls]
[wpv-filter-end] 

#423357

Since I do not have the data of your website, I can not duplicate same problem, Could you duplicate same problem in a test site, fill below private detail box with login details, also point out the problem URL and View URL,

1) when i change the category on the select-box that i've define as a trigger for the condition- it does'nt change the fields in the search at all.
Which one is the "category " select-box?
Which is the fields should be changed?
What should the fields changed into?

2) the search results doesn't change according to the new selected category.
What should the search results changed into?

I need test and debug in a live website, thanks

The topic ‘[Closed] problem with custom search when results in other page’ is closed to new replies.