Accepting more than one appointment per time slot with Appointments+

I am trying to accept more than one appointment per time slot. This isn't possible even with capacity set to 10.

The FAQ says to:

"Capacity field is for limiting the workforce, not for increasing it. You have two alternatives to achieve this: a) Use dummy service providers b) Add these codes in functions.php and modify as required:

function increase_capacity( $capacity, $service_id, $worker_id ) {
return 10;
}
add_filter( 'app_get_capacity', 'increase_capacity', 10, 3 );"

How do I add these codes to the functions.php?

Thanks.

  • aecnu

    Greetings resultsinc,

    Welcome to WPMU DEV!

    You would want to open the functions.php file with your favorite editor and add the lines to it.

    Depending on many things to include your hosting provider and account/cpanel capabilities will dictate your options for getting this done.

    You may also want to simply FTP the functions.php file to your computer, modify it, and then FTP it back to your host over writing the current version.

    Let us know how it goes.

    Cheers, Joe

  • resultsinc

    Hi Joe,

    Thanks for the reply! Sorry for the simple questions I'm about to ask:

    1. How do I access the functions.php file? Is it for the plug in, or for the overall website? I found the editor for the plugin but I can't find the function.php in it.

    2. Once I do find it, how do I know where to copy and paste the code in?

    The website is hosted on bluehost, with a Wordpress as CMS (if that helps at all)

    Thanks!

  • resultsinc

    Function.php file. I added the last four lines...

    <?php

    /*
    * Include OptionTree plugin for theme options.
    */

    /**
    * Optional: set 'ot_show_pages' filter to false.
    * This will hide the settings & documentation pages.
    */
    add_filter( 'ot_show_pages', '__return_true' );

    /**
    * Required: set 'ot_theme_mode' filter to true.
    */
    add_filter( 'ot_theme_mode', '__return_true' );

    global $options;
    $options = get_option('option_tree');

    /**
    * Required: include OptionTree.
    */
    include_once( get_template_directory() . '/option-tree/ot-loader.php' );

    // Breadcrumb

    function my_breadcrumb() {
    if (!is_home()) {
    echo '<a href="';
    echo get_option('home');
    echo '">HOME';

    echo "";
    if (is_category() || is_single()) {
    the_category(' ');
    if (is_single()) {

    echo '<span>'; the_title();echo '</span>';
    }
    } elseif (is_page()) {
    echo '<span>';the_title();'</span>';
    }
    }
    }
    // Page Navigation

    function kriesi_pagination($pages = '', $range = 2)
    {
    $showitems = ($range * 2)+1;

    global $paged;
    if(empty($paged)) $paged = 1;

    if($pages == '')
    {
    global $wp_query;
    $pages = $wp_query->max_num_pages;
    if(!$pages)
    {
    $pages = 1;
    }
    }

    if(1 != $pages)
    {
    echo "<ul class='pagination sixteen columns clearfix'>";
    if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "

  • «
  • ";
    if($paged > 1 && $showitems < $pages) echo "";

    for ($i=1; $i <= $pages; $i++)
    {
    if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
    {
    echo ($paged == $i)? "

  • <span class='button-small-theme rounded3 current' style='background: #352C22;'>".$i."</span>
  • ":"
  • ".$i."
  • ";
    }
    }

    if ($paged < $pages && $showitems < $pages) echo "

  • ";
    if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "
  • »
  • ";
    echo "\n";
    }
    }

    // Custom menu

    add_theme_support('nav-menus');

    register_nav_menu('main_menu', 'Main Menu');

    function display_home2() {
    echo '<ul class="nav clearfix sf-menu sf-js-enabled sf-shadow">
    ';
    wp_list_pages('title_li=&depth=3');
    echo '</nav>';
    }

    class description_walker extends Walker_Nav_Menu
    {
    function start_el(&$output, $item, $depth, $args)
    {
    global $wp_query;
    $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';

    $class_names = $value = '';

    $classes = empty( $item->classes ) ? array() : (array) $item->classes;

    $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
    $class_names = ' class="'. esc_attr( $class_names ) . '"';

    $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';

    $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
    $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
    $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
    $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';

    $prepend = '<span class="title">';
    $append = '</span>';
    $description = ! empty( $item->description ) ? '<span class="description">'.esc_attr( $item->description ).'</span>' : '';

    if($depth != 0)
    {
    $description = $append = $prepend = "";
    }

    $item_output = $args->before;
    $item_output .= '<a'. $attributes .'>';
    $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
    $item_output .= $description.$args->link_after;
    $item_output .= '';
    $item_output .= $args->after;

    $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
    }
    }

    // Post Thumbnails

    add_theme_support( 'post-thumbnails' );

    add_theme_support('automatic-feed-links');
    // Ready for theme localisation
    load_theme_textdomain('localization');

    include("includes/metaboxes/metaboxes.php");
    require_once TEMPLATEPATH . '/includes/comment-list.php';

    /* ==OTHER FUNCTION === */

    function ddTimthumb($img, $width, $height) {

    return get_template_directory_uri() . '/includes/timthumb.php?q=100&zc=1&src=' . $img . '&w=' . $width . '&h=' . $height;
    }

    // Registering our sidebar

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Home Horizontal Widget',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Pages',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Single Classes',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }
    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Single Trainers',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Single Blog Post',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Blog',
    'before_widget' => '<li class="widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Widgetized Module',
    'before_widget' => '<li class="one-third column widget"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    }

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Footer',
    'before_widget' => '<li class="widget one-third column"><div id="%1$s" class="%2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    }

    // Set custom query + Take it off + Related Post

    function dd_set_query($custom_query=null) { global $wp_query, $wp_query_old, $post, $orig_post;

    $wp_query_old = $wp_query;

    $wp_query = $custom_query;

    $orig_post = $post;

    }

    function dd_restore_query() { global $wp_query, $wp_query_old, $post, $orig_post;

    $wp_query = $wp_query_old;

    $post = $orig_post;

    setup_postdata($post);

    }

    include('includes/cpt-classes.php');
    include('includes/cpt-trainers.php');
    include('includes/theme-options.php');

    function fitstyles()
    {

    // Register the style like this for a theme:
    wp_register_style( 'prettyPhoto', get_template_directory_uri() . '/stylesheets/prettyPhoto.css', array(), '20120208', 'all' );
    wp_register_style( 'superfish', get_template_directory_uri() . '/stylesheets/superfish.css', array(), '20120208', 'all' );
    wp_register_style( 'flexslider', get_template_directory_uri() . '/stylesheets/flexslider.css', array(), '20120208', 'all' );
    wp_register_style( 'btn', get_template_directory_uri() . '/stylesheets/btn.css', array(), '20120208', 'all' );
    wp_register_style( 'skeleton', get_template_directory_uri() . '/stylesheets/skeleton.css', array(), '20120208', 'all' );
    wp_register_style( 'base', get_template_directory_uri() . '/stylesheets/base.css', array(), '20120208', 'all' );

    //enqueues our scripts. let's enqueue jquery first to just make sure its loaded first in any case

    wp_enqueue_style( 'prettyPhoto' );
    wp_enqueue_style( 'superfish' );
    wp_enqueue_style( 'flexslider' );
    wp_enqueue_style( 'btn' );
    wp_enqueue_style( 'skeleton' );
    wp_enqueue_style( 'base' );

    }
    add_action( 'wp_enqueue_scripts', 'fitstyles' );

    function cdfScripts() {

    wp_register_script('script', get_template_directory_uri() . '/js/script.js');

    wp_register_script('superfish', get_template_directory_uri() . '/js/superfish.js');

    wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js');

    wp_register_script('easing', get_template_directory_uri() . '/js/hoverIntent.js');

    wp_register_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js');

    wp_register_script('iso', get_template_directory_uri() . '/js/jquery.isotope.min.js');

    //enqueues our scripts. let's enqueue jquery first to just make sure its loaded first in any case

    wp_enqueue_script('jquery');
    wp_enqueue_script('script');

    wp_enqueue_script('prettyPhoto');

    wp_enqueue_script('hoverIntent');
    wp_enqueue_script('superfish');
    wp_enqueue_script('flexslider');
    wp_enqueue_script('iso');

    }

    add_action('wp_enqueue_scripts', 'cdfScripts');

    add_post_type_support( 'post_classes', 'excerpt' );
    add_post_type_support( 'post_trainers', 'excerpt' );

    include("includes/widget-classes.php");
    include("includes/widget-trainers.php");
    include("includes/widget-news.php");

    include_once("includes/tgn-meta-boxes.php");

    //Google Maps Shortcode
    function fn_googleMaps($atts, $content = null) {
    extract(shortcode_atts(array(
    "width" => '640',
    "height" => '480',
    "src" => ''
    ), $atts));
    return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&output=embed"></iframe>';
    }
    add_shortcode("googlemap", "fn_googleMaps");
    function increase_capacity( $capacity, $service_id, $worker_id ) {
    return 10;
    }
    add_filter( 'app_get_capacity', 'increase_capacity', 10, 3 );

  • Paul

    Can I ask again how you are editing the functions.php? Is it via wp-admin or are you using your hosting control panel? If the later I wanted to make sure you are editing the correct theme

    From what I can tell when viewing your site the theme you are using lives in

    /wp-content/themes/FitWP/

    I've checked the plugin code and it should work. Not sure at this point why it does not. We may need to flag the developer.

  • Hakan

    Hi,

    I checked your settings and saw that there is single service provider assigned for each service.

    You are trying to increase the service capacity, but the sole provider who can give that service is personally not available, because he is automatically picked up when an appointment is made (noone else can serve for that service).

    Increasing service capacity will only work if a service provider is not specifically picked up, because A+ always checks personal availability of the service provider and a service provider can have only 1 or 0 workforce value at a given time (1 if he is working, 0 if it is holiday or break). The above function will not override that: It is for increasing service capacity, not for increasing workforce of a service provider.

    It is frequently asked to us why it is not allowed to increase capacity directly from the settings. Your case is an example of why not.

    In fact I am not sure why you did't use Events+ in the first place:
    https://premium.wpmudev.org/project/events-plus/

    From your settings I see that you have only one or two time slots per day. Your providers are possibly not real users and you want to serve more than one client at a time. These are much more suitable for Events+.

    Please check features of Events+ and consider using it.

    If you want to continue with A+, though, it will work with such settings:
    - Set all providers as dummy
    - Add one additional dummy service provider for each service
    - Set their working hours exactly the same as existing providers
    - Connect your dummies to a user (e.g. to admin)
    - Remove service providers shortcode so that client cannot pick up a provider on the front end

    But please note that this a kind of hack, because contrary to Events+, A+ is designed for one-to-one appointments, that is, single service provider serving a single client.

    Cheers,
    Hakan

  • Hakan

    I don't know Membership and Stripe, but I see that you have already asked it here:
    https://premium.wpmudev.org/forums/topic/membership-stripe-gateway

    For Events+ and MarketPress integration I don't think a beta will be publicly released. It is already tested internally now and when it is ready it will be released as a normal version, if everything goes as planned. MarketPress addon inside Events+ may be marked as beta, though (Like GCal API in A+).

    Cheers,
    Hakan

  • Hakan

    It works fine for Athlete service.

    If you mean Energy where you are trying to close Tuesdays, it will not work like that, as your new 10 "virtual providers" will not obey others' working hours.

    Increasing capacity filter is a hack and it has limitations. It won't work in this case, because A+ is not designed for this. I repeat, A+ is for one-to-one appointments, that is, one provider serving a single client at a time, not serving 10 clients.

    Cheers,
    Hakan

  • aecnu

    Greetings resultsinc,

    We have not heard back from you as to the status of this issue.

    If you are still having an issue please let us know so that we may try to get you fixed up as soon as possible by choosing to check mark this ticket as unresolved below and posting any new errors or symptoms you are noticing.

    This action will also bring your ticket up front back in plain view again within the ticket system.

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • Olga

    I am having the same issue... we just spent about 3 days installing Appointments+ to our site and after day 3 just realized that once a single user books an appointment it blocks off all the other slots that are under the capacity field for one provider. The services we offer are guided, with a max number of 6 people per guide. So in one time slot, we need to book a max of 6 different people... meaning 6 individual bookings or doubles whatever... Anyone has any idea how to fix this, before we go back to our old system? Loosing customers here due to this feature not being clear or even available... Oh and by the way, please give me something that does not involve MarketPress, because that won't work for us. Thanks Olga

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.