Saltar navegación

[Resuelto] How to set up grandparent/parent filters

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I am trying to replicate the search shown in the Real Estate reference site, with Makes / Models / Listings instead of State / City / House. The filters don't seem to be working correctly.

Solution: It looks like your post relationships use hyphens instead of underscores, so this was incorrect:

[wpv-control-post-relationship ancestors="make@make_model.parent>model@model_listing.parent" ...

The correct syntax is like this:

[wpv-control-post-relationship ancestors="make@make-model.parent>model@model-listing.parent" ...

Check the post relationship settings to verify the slugs, or use the GUI to insert the filters.

This support ticket is created hace 6 años, 2 meses. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 6 respuestas, tiene 2 mensajes.

Última actualización por Christian Cox hace 6 años, 1 mes.

Asistido por: Christian Cox.

Autor
Mensajes
#1141100

This is my code:

<div class="col-sm-4">
        [wpv-control-post-relationship ancestors="make@make_model.parent>model@model_listing.parent" url_param="wpv-relationship-filter"]
				<div class="form-group col-xs-6">
             	 <label>[wpml-string context="wpv-views"]Make[/wpml-string]</label>
             	 [wpv-control-post-ancestor type="select" default_label="-Make-" ancestor_type="make@make_model.parent"]
				</div>
            	<div class="form-group col-xs-6">
            	  <label>[wpml-string context="wpv-views"]Model[/wpml-string]</label>
              	[wpv-control-post-ancestor type="select" default_label="-Model-" ancestor_type="model@model_listing.parent"]
				</div>
		[/wpv-control-post-relationship]
      </div>

And this is the result:
enlace oculto

Feels like I am close, but something not quite right about the "model" field filter.

Of course, I am trying to get the same kind of result as the "real estate" sample site.
enlace oculto

Only difference is that instead of State>City>House
I have Make>Model>Listing

Any suggestions?

#1141565

Hi, please edit this View in wp-admin. Scroll to the Custom Search panel and make sure the options "Let me choose individual settings manually", "Update the View results every time an input changes" and "Show only available options for each input" are selected. Test again.

If the problem is not resolved, scroll to the Query Filter panel. If you cannot see the Query Filter panel, scroll to the top right corner of the screen and click "Screen Options" to activate the Query Filter panel. Then toggle the post relationship filter open and take a screenshot. Please include this with your next reply.

Then please go to Toolset > Post Relationships and confirm you have two one-to-many post relationships set up. One should be between Make and Model, and the other should be between Model and Listing. Please take a screenshot of these relationships and include them in your next reply.

#1142823
models-listing.png
make-model.png
pagination-options.png
query-filter.png

I've tried to match the View settings for the real estate site exactly but doesnt work.

#1143191

Could I log in to your admin area to see how this is set up? Please provide login credentials in the private reply fields here.

#1144472

It looks like your post relationships use hyphens instead of underscores, so this was incorrect:

[wpv-control-post-relationship ancestors="make@make_model.parent>model@model_listing.parent" ...

The correct syntax is like this:

[wpv-control-post-relationship ancestors="make@make-model.parent>model@model-listing.parent" ...

I made the changes and it seems to be working better now. Can you confirm?

#1144775

thanks! It seems to work now.

For future reference how/where can I find the correct post relationship terms?
I didnt see anyway to check if it should be hyphens or underscores.

#1145799

If you edit the post relationship and check the checkbox "I understand that changes to these settings may delete post associations in this relationship", you will find the slugs for this post relationship.