Skip Navigation

[Resuelto] hierarchy mix? relationship? not sure what to use and how..

This support ticket is created hace 5 años, 4 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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/Karachi (GMT+05:00)

Este tema contiene 18 respuestas, tiene 2 mensajes.

Última actualización por Ido Angel hace 5 años, 4 meses.

Asistido por: Waqar.

Autor
Mensajes
#1301567

Hmmm hey again,
Trying to think about something creative:
If there would be a way that the first two fields, put together, will construct the third and then search only by it...
So if I choose only year, it searches by year.
If I choose only prize name, it searches only by prize name.
But if I choose both, it searches only by the third category, prize + name...

#1301967

How about this:

I can place the three select filters under a div with the same id, and hide only the third. Then:

$('#awards select').on('change', function() {
var yearSelect = $('#awards .year').val();
var awardSelect = $('#awards .title').val();
$('#awards .yearaward').find(yearSelect + "," + awardSelect).attr('selected','selected');
});

Which means whenever any of the first two (year only and award only( change, their selected values are collected, and if there's a matching value of both (plus a comma between) in the third select (year and award together), it gets "selected", and then the search must include "1999", "Booker", and "Booker,1999".
If only one if the first two is selected, there won't be a matching combination in the third, thus it won't be selected.

Could this work?

#1302087

Ok - Update:

I tried this html:

     <div id="awards">
       <label>[wpml-string context="wpv-views"]שם הפרס[/wpml-string]</label>
    [wpv-control-post-taxonomy taxonomy="awards" type="select" class="awardtitle" default_label="--בחר--" format="%%NAME%% <em>(%%COUNT%%)</em>" url_param="wpv-awards"]
    	<label>[wpml-string context="wpv-views"]שנות זכיה בפרס[/wpml-string]</label>
	[wpv-control-post-taxonomy taxonomy="award-winning-yead" class="awardyear" type="select" default_label="--בחר--" format="%%NAME%% <em>(%%COUNT%%)</em>" url_param="wpv-award-winning-yead"]
           </div>
	<label>[wpml-string context="wpv-views"]פרסים בשנים[/wpml-string]</label>
	[wpv-control-post-taxonomy taxonomy="award-in-year" class="awardandyears" type="select" default_label="--בחר--" url_param="wpv-award-in-year"]
</div>
  </div>

with this Jquery:

$('#awards select').on('change', function() {
var yearSelect = $('#awards .awardyear').find(':selected').val();
var awardSelect = $('#awards .awardtitle').find(':selected').val();
$('.awardandyears').find("option[text=[" + yearSelect + "-" + awardSelect + "]").attr('selected','selected');
});

It should have worked (I think), but the problem is that when I select an option from the select menues, the option doesn't get "selected=selected". The first default option stays "selected" forever, and I can't influence the real selected option by code.

Any idea how to get this done?

thx again!

#1302089

BINGO:

$('#awards select').on('change', function() {
var yearSelect = $('#awards .awardyear').val();
var awardSelect = $('#awards .awardtitle').val();
$('.awardandyears').find("option[value=" + awardSelect + "-" + yearSelect + "]").attr('selected','selected');
});

:))))))))))))))!!!!!!!!