Skip Navigation

[Resuelto] Conditional output

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.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Shane hace 6 años, 2 meses.

Asistido por: Shane.

Autor
Mensajes
#1114452

Hi, i've this form:

[credform]
	[cred_field field="form_messages" class="alert alert-warning"]

	<div class="form-group" id="select-number-field">
		<label>Adult </label>
		[cred_field field='adult-number' value='' urlparam='' select_text='Quanti adulti?' class='form-control' output='bootstrap']
	</div>            

	<div class="form-group" id="select-number-field">
		<label>Child</label>
		[cred_field field='children-number' value='' urlparam='' select_text='Quanti bambini?' class='form-control' output='bootstrap']
	</div>

[cred_show_group if="($(price-calculation)  eq  '1' ) OR ($(price-calculation) eq  '2' )"  mode='fade-slide']   
	<div class="form-group" id="select-number-field">
		<label>Room</label>
		[cred_field field='room-number' value='' urlparam='' select_text='Quante camere?' class='form-control' output='bootstrap']
	</div>
[/cred_show_group]

	<div class="form-group" id="select-number-field">
		[cred_field field="form_submit" output="bootstrap" value="Prenota" class="request-button btn btn-primary btn-lg"]
	</div>      

[/credform]

As you can see I've use a condition to display the field room.

But doen't works. the filter is "price-calculation" which is a custom field og a different group then the fields of the form (adult, child and room)

How can I do this condition?

#1115204

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Domenico,

Thank you for contacting our support forum.

You are saying that the field in the conditional is from another post itself?

Also where is the form, is it on the parent post ? Was it navigated to from the Parent post?

Please let me know as your current setup will not work since the field is not on the actual post itself.

Thanks,
Shane

#1115635

Hi Shane,

The form is "Booking form" and it creates new custom post typ "my-orders"

In this form there is a field "room-number" which is part of a custom field group associated to custom post typ "my-orders"

I've also a field "Type-of-price" whcih is aprt of a custom field group associated to "woocommerce product"

I need to use this last (type-of-price) as condition to display "room-number"

#1115847

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Domenico,

You mean that you need to get the price of the last person who booked and use that to generate a new price to add to the conditional ?

Please let me know.
Thanks,
Shane

#1115866

Hi Shane,

No, what I mean is easyer (I think).

[cred_show_group if="($(price-calculation)  eq  '1' ) OR ($(price-calculation) eq  '2' )"  mode='fade-slide']   
    <div class="form-group" id="select-number-field">
        <label>Room</label>
        [cred_field field='room-number' value='' urlparam='' select_text='Quante camere?' class='form-control' output='bootstrap']
    </div>
[/cred_show_group]
 

price-calculation should be my "filter" In base of its value the field. "price-calculation " is in a group custom field associated to woocommerce product.

The form and all the fields are associating to custom post type "my-orders"

"product" and "my-orders" are not related

#1116625

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Domenico,

I don't think i'm seeing the bigger picture.

For the cred_show_group conditional code to work, the value you are checking must be on the form itself.

Is this field entered on the form ? Or is the value of this field being retrieved from somewhere else ? This is the part i'm not sure about.

Thanks,
Shane