Events Made Easy Forums Bug fixed or feature request implemented Do all #_SEATSx have to "show " for the multiprice to work?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #44102
    Anonymous
    Inactive

    Not sure if this is a bug or a feature design, so I apologize if this is incorrectly labeled…

    I am is using the multiprice option to create 5 Seat prices, with the first 2 being the holders for a discounted ticket ($65 before/on Feb 1(seat1) and $75 after Feb 1(seat2) ). To deal with the discount, I am using conditionals such that only 1 of the seats would be active at a time ie.

    [events_if tag='#ESC_DAYS_TILL_START' gt='82']

    #Tickets $65 #_SEATS1<b>[/events_if]

    [events_if tag='#ESC_DAYS_TILL_START' value='82']

    #Tickets $65 #_SEATS1<b>[/events_if]

    [events_if tag='#ESC_DAYS_TILL_START' lt='82']

    #Tickets $75 #_SEATS2[/events_if]

    So if on/before Feb 1, the $65 ticket shows and if after, the $75 ticket option shows.

    What I am finding, is that the code is shifting the placeholders downward so that it “skips” the seat that does not apply in the conditional and shifts all of my inputs down, so that it looks like there is only 4 multiprices instead of 5.

    So in effect, if it is before Feb 1 (then #_SEAT2 is not showing) and I choose another item at price 3, I find that the plugin is assigning that input value to #_SEAT2 instead of #_SEAT3, and so on. Thus, all of the inputs are off by 1 and #_SEAT5 never holds a value.

    One other thing that I noticed when testing, was that if I place the #_SEATS2 (without any conditional) at the end of all of the inputs (or anywhere “out of order”), I also get the same effect.

    Is the the way the code was designed, if so I probably need to find a workaround, or is there something else I may have done incorrectly?

    #50936
    Franky
    Keymaster

    Errr … people tend to do weird stuff 🙂

    But you’re right, I think I found the issue. In the file eme_rsvp.php, function eme_book_seats(), I’m initializing at line 332 a variable as an empty array (booking_seats_mp). And when you submit a form, I fill in correctly the array at the correct defined position for the mentioned seats.

    But: since it’s a php array, the “key” value in the array is not sequential, just a string. And in the function eme_record_booking (called in eme_book_seats), I do a join on that array. And here’s the error of course …

    So the correct thing to do is to initialize the array with “0” for each multiprice (at line 332 add the following):

    $bookedSeats_mp = array();
    $booking_prices_mp=preg_split("/||/",$event['price']);
    foreach ($booking_prices_mp as $key=>$value) {
    $bookedSeats_mp[$key] = 0;
    }

    That should help. I’ll add that code this evening.

    #50937
    Franky
    Keymaster
    #50938
    Anonymous
    Inactive

    Getting closer – thanks so much!

    Here is what I am seeing now.

    My multiprices: 65||75||12||13||45 (the first 2 are attendance, the last 3 are meals)

    When I select 1 for #_SEATS1 and 1 for #_SEATS5 instead of getting 1||0||0||0||1,

    I am now getting: 0||1||0||0||0||1

    Thanks again for helping with this!

    #50939
    Franky
    Keymaster

    Yeah, tested it and found it, a oneliner:

    http://plugins.trac.wordpress.org/changeset/818431

    #50940
    Anonymous
    Inactive

    Ahh! Beautiful – thank you!

    #50941
    Franky
    Keymaster

    And to make it easier with your conditional tags, I added “le” and “ge” comparisons:

    http://plugins.trac.wordpress.org/changeset/818512

    #50942
    Anonymous
    Inactive

    And thank you again! Appreciate it!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.
Scroll to Top