Skip Navigation

[Resolved] Problem with two different views for custom search inside tabs

This support ticket is created 4 years, 7 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 14 replies, has 2 voices.

Last updated by silvian 4 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1602565

Tell us what you are trying to do?

Hi Guys, how are you? I hope everything is ok, althoug these are though moments for everyone in the world!!
I'm working with toolset & elementor trying to build a real estate website. I would like to show a custom search (made with T. Views) in a sidebar. However I have 2 different post types:
Vendita (= for sale)
and
Affitti ( =for rent)
so the search fields should be a little different (eg. different price ranges , which would be predefined fields )

I thought it would have been nice to create 2 tabs in the sidebar, so the user could switch between the search forms, one for "Vendita" and one for "Affitti" depending on what he's looking for.
The problem is that I cant' put the Toolset shortcodes inside the tabs, I mean that one shortcode works fine, two shortcodes inside the same tabs work as well, but one shortcode in a Tab and another one in the other tab doesn't work. I 've been trying both with the Elementor tab widget and also with an html widget but it doesn't work either.

* ( in this moment, please suggest me what it's better, if creating 2 different post types or working with taxonomies. So far is equal for me, I made 2 different post types because I thought It would have been easier for me to build the search form... but so far I have problems anyway - at the beginning I had one Custom Post Type, 2 custom taxonomies, for sale & for rent, and I thought to make just one custom search, with "cascading" conditional filtering based on the first taxonomy filter, but I though it was too difficult for me, so I wanted to split everyting but now I'm facing issues as well. )

Please HELP!!
hidden link
the blue sidebar is the Elementor Widget, while the other content below is an HTML tab I made for testing. I should already have sent you login credentials, if you need I can resend them to you.
Thank you so much
Silvia

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1603535

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would suggest that you should have one post type and you can categorize your post using taxonomy Rent or Sale. You should have one posttype for example properties.

Later, you will have to create only one view and even you do not need to add tabs so your view rendering issue on second tab will also be resolved.

In addition to that, Toolset also offers a free test platform http://www.discover-wp.com, where we offer ready to use reference sites build on top using Toolset and the good news, is that we offer a reference site Real Estate that will really help you to learn and you should create a test site using that reference site and play with that.
=> https://discover-wp.com/register/?site_type=713&layouts=yes

#1603669
Cattura.PNG

Hi Minesh,
thank you for your reply.
I'll check the platform and the reference site, thanks.
However since I need to release the website quite urgently, I'll be more precise and straighforward with my question:

Assuming that I have one custom post type "properties" and two taxonomies: "sale" and "rent", how can I create a custom search showing the MIN PRICE and MAX PRICE filter (dropdowns with different values) based on the first filter of the search form, which would be radio buttons or a select, with the taxonomies?

To be more clear: I would like to have that the user in the search form selects RENT and the filters that appears then are MIN PRICE RENT and MAX PRICE RENT, with some values
While if he selects SALE, he will be shown MIN PRICE SALE and MAX PRICE SALE with other values.
Is that possible? Is there any piece of code I can follow ?

(looking at the picture, instead of having tabs, I can have a select, based on the user's choice, PREZZO MIN and PREZZO MAX dropdowns should show each one different values)

THANKYOU!

#1603867

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Do you mean that for the price filter you want to change the label of the price filter.
- So, if user select the rent, the label should display Min Price Rent and Max Price Rant
- if user select sale, the label should display Min Price Sale and Max Price Sale
==>
So, to achieve the above you need to write custom jQuery code where you should change the filter label as per the rent or sale selection.

Please correct me if I am wrong.

#1603963
Cattura.PNG

Hi Minesh,
thanks for your reply.

I don't need to change the labels, I need to change the values inside the dropdowns
while prices for rent are monthly prices, prices for sale are much much much higher!
So the dropdowns can't be the same.

Since I'm not proficient with JQuery and coding, this is the reason why I thought It would have been easier for me to have two different custom searches, one for rent, and one for sale.

When I had this idea at first, I thought in Toolset View I could create Views for Searching on Custom Post Types, but somehow filtered by taxonomies "at first"

(please see image in attach, I would have expected to find there some more options, so that I could choose custom post Types "Annunci" ( = properties) but only the ones with taxonomy "For Rent" (in affitto) in Search 1 , and custom post types "Annunci" but only the ones with taxonomy "For Sale" ( In vendita) in Search 2.

Since I realized that wouldn't be possibile, I had the idea to split the Post Types, and to make 2 Views, but I'm still in trouble because the shortcodes, put in tabs, don't work.

So please could you help me find the most straightforward way to obtain what I need ? Which is :
Having different price ranges in search, basing on the type of properties: rent or sale.

I hope it's clear enough, please don't hesitate to ask me if you need any more details!!

Thank you so much for your support

#1603995

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sure - I will be really glad to help with your issue.

I understand and I would like to know, you store the price for rent and sale to the same custom fields or you have different custom fields that stores the price for rent and for sale.

If you can share access details I will quickly look at your setup and check.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1604061

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok I got it.

As you are using the same custom field to store the price and you said the price for the rent will the low and sale will be high.
- The thing is that, when you add custom price field filter on frontend, it will display all the price options with the filters regardless of what is the property type, either rent or sale.

So, what if you create another custom field, "Price Rent" and rather adding taxonomy property type (rent, sale), what if you add a custom field that stores the property type (rent, sale).

If you add a Radio custom field that have the option (Rent or Sale), when you select the option based on the selection you can show/hide the price custom field.

I have setup a demo for you to demonstrate this:

Admin: hidden link
User: demo
PWD: Admin@123

I've setup a custom field group with three fields. Property Type (sale,Rent) and Price Sale and Price Rent.
=> hidden link
- As you can see, I've added the conditional to "Conditional display" part of Price Rent and Price Sale fields. So, if you select rent, the rent price will be displayed and if you select sale it will display the sale price.

You can check how it works in backend using this:
=> hidden link
- select the property type options and you will see how it works.

Now, on frontend, when you add filters, you need to ad both price rent and price sale custom field filters but you need to add some js/jQuery code as when you select Sale option, it should display sale price filter and if you select rent, it should display rent price filter.

#1604149

OK, thanks!! I understand your solution and I Think it's good.
So If I set up the things as you suggest, then would you help me with the jQuery coding part? I suppose that it would be just few lines of codes but really I don't know where to begin with writing my self a custom script. Or if not you, do you know who I can ask with Toolset or some associates? I can pay for the time spent if needed of course.

thank you!!

#1604163

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that solution I shared will help you to solve your issue.

It outside the scope of our support policy but as this is really small thing.

Once you setup your view with both the filters please send me the view link and I will add the required JS code.

#1605269

Hi Minesh, good morning.
I hope everything is fine.
I'm trying to setting up things as we said , but I have some troubles with the filters and I really can't understand what's wrong.

In the backend I added the Custom Field "Tipo Annuncio" and now I have two prices with conditional display.
This is working fine. Here's the Custom Fields List: hidden link (Prezzo di Vendita stands for Sale Price, Canone di Affitto stands for Rent Price) . This is ok.

Here it's working as well : hidden link (now just one custom post type)

Where it's nt working is the Search View. I cannot manage to make the new filters working (I'm not referring to the JS part which is not yet done)

hidden link

(I'm working on the Ricerca Annunci Sibebar , id 306) . The property type filters doesn't show right in the frontend.

I Tried with many options( radio buttons, dropdowns, manually insert values, as displayed in the database... all possibile combinations I think 🙁 ) , , but all that I can make visibile is just one option, the one with value 1, while the other one never shows!

Moreover I reealized also the other fiters are not showing properly. I can0t see all the values in the frontend , if you compare the search view as written in the Toolset editor and what appears in the frontend, you'll se different values!
This is happening with the new prices filters, as well as with "old" MQ Min / MQ Max Filters. Just some values are shown in the frontend, not all!

The frontend of the serach view is here: the blu box hidden link

Please help me, I'm getting crazy at this. I don't know what's wrong, I can't find out, I'm really confused 🙁
Thank You Minesh

#1605421

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

First of all, I see you have only one post and for that post you did not set the property type (Rent or Sale). You should set the post to either rent or sale.

Now, with the view:
=> hidden link

I have set the "Custom Search Settings" to "Always show all values for inputs" as you can see with the following screenshot:
=> hidden link

On the homepage now, hidden link I can see the radio fields.

#1605439

Great Minesh Thanks!!!
For the post type, probably at first I had set a default value for Property value, than I chenged with no default and i forgot to edit the post. Thank you
And for the view, thank you twice!!! I din't know about that options "Always show all values for inputs", now I see. 🙂
So I believe If you can write the JS we are done
what has to happen is :

if it is selected VENDITA , Prezzo di Vendita MIN and Prezzo di vendita Max has to be visible , while Canone di Affitto Min and Canone di Affitto Max has to be hidden
and "vice versa"

I believe after this, we are done. Thank you again really really really much. You saved me!!

#1605445

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following jQuery code to your view's "Search and Pagination" section JS box.

jQuery(document).ready(function($){
 $('input[value="vendita"]').attr('checked', true).trigger('change');
  
$('input[type=radio][name="wpv-wpcf-tipo-annuncio"]').change(function() {
    if (this.value == 'vendita') {
        $("#filter_rp").hide();
        $("#filter_sp").show();
    }
    else if (this.value == 'affitto') {
        $("#filter_sp").hide();
       $("#filter_rp").show();
    }
});
  
  
});

I can see its working as expected: hidden link

#1605491

My issue is resolved now. Thank you!

#1619349

Hi Minesh! How are you? I hope you're fine
Sorry to bother you again: my website is nearly finished, but I realized I have an issue on the search view.
Do you remember the jquery code that you wrote for me?
If you select "Vendita" some fields are visible and some other are hidden,
while if you select "Affitto", it's the opposite.

Here: hidden link (Ricerca Rapida box) it's working well, everything as expected , while here: hidden link - it's not working (click on the blue/yellow button to make the search visible) - If you select "Affitto" the prezzo Min/Max are not hidden, and the other fields still are not visible.

I believe the code it's the same. The Views that I'm talking about are the - 438 id Ricerca Sidebar OK (the one which is working)
and the 285 id Ricerca Annunci Archive Top ( the one which is not working on hiding and the displaying the right prices fields)
Could you please have a look and check what's wrong? I can't find any difference !

Thank you Minesh!

Grazie
Silvia