Home › Forums › Ticket Products › Event Tickets Plus › Variable Quantity and Zero Quantity
- This topic has 10 replies, 4 voices, and was last updated 8 years, 7 months ago by Support Droid.
-
AuthorPosts
-
September 12, 2015 at 9:03 am #1004556smalldogcreativeParticipant
Greetings,
SOOO very glad we’ve adopted TEC for our Events Management system. The Follow Up Emails integration with WooCommerce? PRICELESS! Thank you.
For a given event for which we have two ticket types, we need to set one to 1, and the second to 0. Following the directions here https://theeventscalendar.com/knowledgebase/handling-ticket-quantities/ seem to default all to 1. Is there an argument that can accommodate this?
Also, when the event is initially viewed, ticket values are set to 0 however, once changed to 1 (or more), they cannot be returned to 0. We need the ability to return the quantity to 0.
The desired outcome is that we set ticket one to 1 and ticket two to 0, but allow the customer to return ticket one to 0 and select 1 of ticket two.
How can we accomplish that?
September 14, 2015 at 3:16 am #1004751oniregocParticipantHi
same for me but I found an elegant way :
there is a plugin call “WooCommerce Advanced Product Quantities”work very well and very powerfull.
Hope it helps !
September 14, 2015 at 6:31 am #1004791GeorgeParticipantHey @smalldogcreative,
Thanks for reaching out!
Just to be 100% clear, when you talk about “1” and “0”, you mean for the front-end ticket quantity selectors, right? For example, the left-most quantity selectors in the following screenshot of a tickets list that users can buy tickets from:
If I understand your goals correctly, then there is unfortunately only one way to achieve what you’re looking for which is to use JavaScript on page load to set the quantity field’s value to either “1” or “0” (or any other number, I guess).
However, the tricky thing here is that you couldn’t really have code that dynamically knows which ticket to set to 1 or 0, so it would have to set both tickets to the same value: either both to 1, or both to 0 π I’m sorry about this, but it just an inherent limitation in the way things work.
@oniregoc’s recommended solution may work, and your chiming in is much appreciated @oniregoc! The only alternative I can think of would be the JavaScript solution I described above which, of course, comes with its own limitations.Sorry to share that news, @smalldogcreative. If you’re still interested in the JavaScript despite its limitations, let me know, I can share how to do that here.
On a side note, thanks a ton for the kind words about the plugin π I’m glad that, aside from this quantity behavior specifically, it’s working well for your project!
Cheers,
GeorgeSeptember 14, 2015 at 8:40 am #1004873oniregocParticipantHello,
Yes my solution is working fine…you will see it in action soon when my website will not be anymore “in construction”. I am using a very complicated solution to be able to let the user buy tickets for the events day or a ticket he may use any other day for the photo cours available in the categorie for one year…and gift tickets buyers can send to friends..etc…
very, very tricky soltion because if events calendar is an aamzing plugin he is missing a lot of basic options.
π
September 14, 2015 at 9:28 am #1004914smalldogcreativeParticipant@George, thanks for your detailed response. Correct, the quantity fields you pointed out in the screenshot are the fields to which I am referring.
The tickets for every event will be created in the same order and always be present (at least as far as we know now), so perhaps we can isolate it and modify it using jQuery/JavaScript as you suggested.
Thanks for your input @oniregoc. I will have a look at WooCommerce Advanced Product Quantities and report back.
SDC
September 14, 2015 at 4:36 pm #1005058oniregocParticipantHi,
I will open a new ticket because what is not working at all is that if you have a “coupon” attache to the first ticket and you want to buy the second ticket only…you receive the coupon of the first product…and worst : you can see the coupon code before buyng the ticket !
September 15, 2015 at 6:44 am #1005217GeorgeParticipantThanks for posting that coupon-related issue in another thread @oniregoc, it’s indeed a separate issue so if it’s in another thread we can keep things organized and solve both problems for efficiently.
Now, @smalldogcreative βΒ thanks for confirming the fields to use and such! If you’re always going to have the tickets displaying in the same order, so that for example you have three tickets on display always, and the first ticket is always going to start with quantity of “1” (and all tickets after / below the first one starting with quantity of “0”), then JavaScript will indeed work well here. This is especially true because of jQuery being loaded on most WordPress-generated pages, so you can use its methods like $.first() or $.last() to get elements based on their display order very, very easily.
An example of doing this would be as follows, which if you drop into your theme’s functions.php will demonstrate the example I gave above: the first ticket in list always starts with “1” selected for the quantity, while all other tickets listed start with “0”
if ( function_exists( 'tribe_get_events' ) ) :
/**
* Force first-ticket quantity to "1"
* @link http://theeventscalendar.com/support/forums/topic/variable-quantity-and-zero-quantity/
*/
function tribe_support_1004556() {
if ( ! is_singular( 'tribe_events' ) ) return;
if ( ! wp_script_is( 'jquery', 'enqueued' ) ) wp_enqueue_script( 'jquery' );
?>
<script>
jQuery(document).ready(function($) {
$( '.tribe-events-tickets tr' ).first().find( '.input-text.qty.text' ).val( '1' );
});
</script>
<?php
}add_action( 'wp_footer', 'tribe_support_1004556' );
endif;Here’s how this code makes things look once its applied:
I hope this helps! If anything, hopefully it at least gives you a good place to start that you can then take and tweak to your site’s specific needs.
Cheers,
GeorgeSeptember 15, 2015 at 12:34 pm #1005372smalldogcreativeParticipant@George – worked like a charm, but raises another question:
How do I insure that the desired ticket is the first item? Is there a sort, or are they listed in order of entry?
And, how can I allow the quantity to be returned to 0 for any item? They are currently set to 0 when the event first loads, but after selecting either item, they cannot be reset to 0.
Steve
- This reply was modified 8 years, 8 months ago by smalldogcreative.
September 15, 2015 at 12:35 pm #1005373smalldogcreativeParticipantIncidentally, @oniregoc’s Advanced Quantity did NOT work as expected.
Steve
September 16, 2015 at 12:34 pm #1005737GeorgeParticipantHey Steve,
How do I insure that the desired ticket is the first item? Is there a sort, or are they listed in order of entry?
The last ticket you create on the “Edit-event” screen will be the first/top-most ticket to display on the front-end view of the event. I hope that with this information and your comment here that this is a useful solution for you:
The tickets for every event will be created in the same order and always be present (at least as far as we know now), so perhaps we can isolate it and modify it using jQuery/JavaScript as you suggested.
Do you think this will be a useful solution? Let me know what you think! π
Thanks,
GeorgeOctober 1, 2015 at 7:05 am #1010407Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Variable Quantity and Zero Quantity’ is closed to new replies.