Forum Replies Created

Viewing 15 replies - 16 through 30 (of 33 total)
  • Thread Starter JohnCleary

    (@johncleary)

    Donation made…thanks for your help ??

    Thread Starter JohnCleary

    (@johncleary)

    Thanks will try the multiple events…

    I changed:

    [ Moderator note: please wrap code in backticks or use the code button. Really, the code button is your friend. ]

    if ($seats> 2)
              $price = $seats * 25;

    to:

    if ($seats> 1)
    $price = 25;

    Thread Starter JohnCleary

    (@johncleary)

    Ok, I’ve got it working now for one event using the below… Thanks Franky.

    How do I duplicate this for several events?

    *************************************************************************

    [ Moderator note: please wrap code in backticks or use the code button. ]

    add_action('eme_insert_rsvp_action', 'my_eme_discount_function',20,1);
    function my_eme_discount_function($booking) {
       global $wpdb;
       $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
       $where = array();
       $fields = array();
    
       $event_id = $booking['event_id'];
    
       if ($event_id == 5) {        /* put in the event_id that needs processing */
          //echo 'EVENT ID='.$event_id .' Booking_id = '.$booking['booking_id'];
    
          $seats=$booking['booking_seats'];
          $price=$booking['booking_price'];
    
          // more than 2 seats, then the price is 25 per seat
          if ($seats> 1)
              $price = 25;
    
          $fields['booking_price'] = $price;
          $where['booking_id'] = $booking['booking_id'];
          $wpdb->update($bookings_table, $fields, $where);
       }
       return;
    }
    Thread Starter JohnCleary

    (@johncleary)

    OK. I think I’ve gone some way to fix it now…I’ve amended the logic slightly as the price is reduced if the client is buying >1 ticket.

    However it appears that the multiplication is now being done twice…as the amount being asked for is £100 for 2 tickets (£25 x2 x2) and £225 for 3 (£25 x3 x3).

    Have I done something wrong here?

    Thread Starter JohnCleary

    (@johncleary)

    Oops I cut and pasted the info from the wrong page into this thread…I did use the correct text…. below is what I have used on my website with the previously mentioned results.

    add_action('eme_insert_rsvp_action', 'my_eme_discount_function',20,1);
    function my_eme_discount_function($booking) {
       global $wpdb;
       $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
       $where = array();
       $fields = array();
    
       $event_id = $booking['event_id'];
    
       if ($event_id == 5) {        /* put in the event_id that needs processing */
          //echo 'EVENT ID='.$event_id .' Booking_id = '.$booking['booking_id'];
    
          $seats=$booking['booking_seats'];
          $price=$booking['booking_price'];
    
          // more than 2 seats, then the price is 25 per seat
          if ($seats> 2)
              $price = $seats * 25;
    
          $fields['booking_price'] = $price;
          $where['booking_id'] = $booking['booking_id'];
          $wpdb->update($bookings_table, $fields, $where);
       }
       return;
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thread Starter JohnCleary

    (@johncleary)

    Thanks for this Franky. I have either misunderstood or done something wrong as I added the code under the line below to the functions.php file (Which is the above with simply the event ID changed to match the ID that I wanted the ‘multibuy’ price for.) When I did this the price was reduced to zero. I suspect that I’m very close to being there but can’t work out what else I need to do!?

    ****************************************************************************************
    add_action(’eme_update_rsvp_action’, ‘count_only_attendance_tickets_on_update’,20,1);
    function count_only_attendance_tickets_on_update($booking) {
    global $wpdb;
    $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
    $where = array();
    $fields = array();

    $event_id = $booking[‘event_id’];

    if ($event_id == 5) { /* put in the event_id that needs processing */
    //echo ‘EVENT ID=’.$event_id .’ Booking_id = ‘.$booking[‘booking_id’];

    $seats=preg_split(“/\|\|/”,$booking[‘booking_seats_mp’]);

    /* use only attendance tickets,#_SEATS1 and #_SEATS2, array values 0 and 1 */
    $tix_tot = $seats[0] + $seats[1];

    $fields[‘booking_seats’] = $tix_tot;
    // echo ‘Attendence tix_tot =’ . $tix_tot;
    $where[‘booking_id’] = $booking[‘booking_id’];
    $wpdb->update($bookings_table, $fields, $where);
    }
    return;
    }

    Thread Starter JohnCleary

    (@johncleary)

    No worries…if you can drop me a step by step instruction, I would gladly make a donation to the project.

    Thread Starter JohnCleary

    (@johncleary)

    Thanks Framky.

    I’ve had a look at that link and I’m afraid it doesn’t make that much sense to me ?? I’m not really a developer. J

    Thread Starter JohnCleary

    (@johncleary)

    Thanks Krishna…it was a plugin. All working now Thanks again.

    @michael Cannon all working for me too and I’ve purchased the premium version too. I’ve been trying to find instructions/documentation on how to set it up. Where’s the best place to find that info?

    I created a php.ini file and put this in it:

    memory=128MB
    upload_max_filesize=128M;
    post_max_size=128M;

    I put that ini file in the root of my installation AND the wp-admin, but still had the same error.

    @michael Cannon Thank you, I will try this…although I’m surprised that this sort of configuration would be necessary on three separate WP blogs, 2 hosted with a major hosting company and one of those being a virtually clean install!?

    @michael Cannon I tried to install the free version less than 3 hours ago to check the plugin out and I had the issues I described above. Happy to help with supplying whatever other info you might need to debug. Am using the latest version of WordPress.

    @sejack…Aha! Then that was my error….thanks for the info.

    @sejack Thanks for your input, at the time of writing that folder didn’t seem to exist, however on restarting the FTP program it appears that it was a cacheing issue…website is back up now. Phew!

    Would love to be able to use this plugin though…it looks great!

Viewing 15 replies - 16 through 30 (of 33 total)