Events Made Easy › Forums › Bug fixed or feature request implemented › Do all #_SEATSx have to "show " for the multiprice to work?
Tagged: multiprice conditional
- This topic has 7 replies, 2 voices, and was last updated 10 years, 11 months ago by Anonymous.
-
AuthorPosts
-
Tue 10 Dec 2013 at 13:35 #44102AnonymousInactive
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?
Tue 10 Dec 2013 at 16:43 #50936FrankyKeymasterErrr … 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.
Tue 10 Dec 2013 at 17:53 #50937FrankyKeymasterTue 10 Dec 2013 at 19:32 #50938AnonymousInactiveGetting 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!
Tue 10 Dec 2013 at 20:21 #50939FrankyKeymasterYeah, tested it and found it, a oneliner:
Tue 10 Dec 2013 at 20:29 #50940AnonymousInactiveAhh! Beautiful – thank you!
Tue 10 Dec 2013 at 22:39 #50941FrankyKeymasterAnd to make it easier with your conditional tags, I added “le” and “ge” comparisons:
Wed 11 Dec 2013 at 23:09 #50942AnonymousInactiveAnd thank you again! Appreciate it!
-
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.