Search Results for 'booking form'

WordPress Event Management, Calendars & Registration Forums Search Search Results for 'booking form'

Viewing 15 results - 436 through 450 (of 932 total)
  • Author
    Search Results
  • #19849

    Stephen Harris

    Marc,

    Feel free to ask for me to go in more detail, but here’s the broad picture (with comments where I’ve omitted details specific to your use case):

    1. Enable file uploads on the booking form
    The booking form by default only supports $_POST data. To support file uploads you’ll need to add the attribute enctype="multipart/form-data" to the <form> tag in templates/eo-booking-form.php template:

    <form enctype="multipart/form-data ...>
      ...
    </form>
    

    Copy that file to the root directory of your theme and edit there so it survives updates to the plug-in.

    2. Declare the Element class
    This is similar to your class but I’ve extended the EO_Booking_Form_Element_Input class – this is for convenience as I no longer have to declare a view. Views are registered as you have shown, but if my element doesn’t have a view it will proceed through the class’ ancestors until it finds a View. In this case, the parent is EO_Booking_Form_Element_Input which does have a view class: EO_Booking_Form_Element_Input_View – and this just so happens to be exactly what I need: an <input> with a configurable type (which I set below in get_field_type())

    Of course if you wish you can register your own View class if you wish.

    class EO_Booking_Form_Element_File extends EO_Booking_Form_Element_Input{
    
        static function get_type_name(){
            return 'Fichier';
        }
    
        function get_field_type(){
            return 'file';
        }
    
        function get_defaults(){
            return array(
                'label' => 'Fichier',
            );
        }
    
        function get_data(){
            return $this->get( 'data' );
        }
    
        function validate( $input ) {
    
            //@see http://php.net/manual/en/reserved.variables.files.php for details
            $file = array(
                'tmp_name' => $_FILES['eventorganiser']['tmp_name']['booking']['file'],
                'name'     => $_FILES['eventorganiser']['name']['booking']['file'],
                'size'     => $_FILES['eventorganiser']['size']['booking']['file'],
                'error'    => $_FILES['eventorganiser']['error']['booking']['file'],
                'type'     => $_FILES['eventorganiser']['type']['booking']['file'],     
            );
    
            //Validate file, e.g. check type, check for errors, and check for size
            //PLease note that $file['type'] can be spoofed - its best to analyzie the contents of the file
    
            //if there is any error: $this->add_error( 'my-error-code', 'Error message' );
    
            //Otherwise set value
            $this->set_value( $file );
    
        }
    
        function save( $booking_id ) {
    
            $file = $this->get_value(); //returns the array set above in validate().
    
            //You can now upload the file
            //@see https://codex.wordpress.org/Function_Reference/wp_handle_upload
            $_file = wp_handle_upload( $file,  array( 'test_form' => false ), time() );         
    
            //Once the file is uploaded you could either
            //Store a reference to the file location in as booking meta,
            //Or use wp_insert_attachment and store a reference to the attacment ID in booking meta
    
            //In either case, to add booking meta
            //update_post_meta( $booking_id, 'my_meta_key', 'my_value' );
    
        }
    
    }
    

    I’ve simply added two methods to the class. First is validate() – this is where you should perform any checks on the file. You might want to consider:

    • Analysing the type and content of the file to prevent any uploads of malicious files
    • Imposing a size limit on the file
    • Checking the error number: it should be 0 if all is well

    The function also sets the value of the element so that we can retrieve this later (i.e. in save()). (This really could/should be set earlier but this will suffice). To prevent the booking from proceeding and return the user to the booking page with an error message, simply add an error the element as shown.

    The second method is save( $booking_id ). This is triggered after the booking is made (not necessarily confirmed) and this where you should upload the file to the server. (wp_handle_upload() is good for that).

    You should then store a means of linking a file and a booking. You could do that by simply storing the file location as post meta. Or create an attachment for the uploaded file and store the attachment ID as a booking meta data. (Bookings are posts so you can use the usual post meta functions).

    3. Add to the form

    Please note that this is part of the API may change – you can alternatively programatically add the element the form.

    To do add the element to the form customiserL:

     EO_Booking_Form_Controller::register( 
         'file', //element type ID
         'Fichier', //Label for the form customiser
         'http://yoursite.com/url/to/backbone-model.js',  //url to customiser 'model'
         'http://yoursite.com/url/to/customiser-view.tmpl',//url to customiser view
         'advanced' //which metabox to add the button to: standard, advanced
     );
    

    The model ‘is’ your file element type in the customiser. It essentially stores the default values of an instance of that type.

    eo.bfc.Model.EOFormElementFile = eo.bfc.Model.EOFormElementInput.extend({
        defaults:{
            label: eo.gettext("Fichier"),
            name: eo.gettext("Fichier"),
            description: "",
            required: false,
            field_type: 'text',
            parent: 0,
        },
    });
    

    you could specify the settings, but we’ll just inherit the settings for input.

    The template is used to generate a preview of the element in the customiser. E.g. put the following in the .tmpl file:

    <label>{{label}}</label><# if( required ){ #><span class="required">*</span><#}#><br>
    <input type="file" disabled="disabled" />
    <# if( description ){ #><p class="description">{{description}}</p><#}#>
    

    Side remarks: Backbone is used for the Model and Views in the customiser and Underscore is used for template rendering.

    #19806

    Marc FRÈREBEAU

    Hi Stephen,

    Thanks for your answer.
    In fact I have explore extension files where the class EO_Booking_Form_Element_input to imitate construction.

    I see my field in the interface but it’s not finish… Her the code I beginning :

    class EO_Booking_Form_Element_File extends EO_Booking_Form_Element{
        
        static function get_type_name(){
            return 'Fichier';
        }
        
        function get_field_type(){
            return 'file';
        }
        
        function get_defaults(){
            return array(
                'label' => 'Fichier',
            );
        }
        
        function get_data(){
            return $this->get( 'data' );
        }
    
    }
    EO_Booking_Form_Element_Factory::register( 'file', 'EO_Booking_Form_Element_File' );
    
    class EO_Booking_Form_Element_File_View extends EO_Booking_Form_Element_View{
    
        function render(){
            ob_start();
            include( get_stylesheet_directory() . '/templates/EO_Booking_Form_Element_File.php' );
            $html = ob_get_contents();
            ob_end_clean();
            return $html;
        }
        
        function get_value(){
            return $this->element->get_value();
        }
    }
    EO_Booking_Form_Element_View_Factory::register ( 'file', 'EO_Booking_Form_Element_File_View' );
    
    EO_Booking_Form_Controller::register( 'file','Fichier', 'EO_Booking_Form_Element_File', get_stylesheet_directory() . '/templates/EO_Booking_Form_Element_File.php' );
    
    

    And I create this template :

    <?php include( eo_locate_template( 'eo-booking-form-label.php' ) ); ?>
    
    <input
        type="<?php echo esc_attr( $this->element->get_field_type() );?>"
        id="<?php echo esc_attr( 'eo-booking-field-'.$this->element->id );?>"
        name="<?php echo esc_attr( $this->get_name() );?>"
        class="<?php echo esc_attr( $this->get_class() );?>"
        style="<?php echo esc_attr( $this->element->get( 'style' ) );?>"
    
    <?php if( $this->element->is_required() ):?>
        required="required"
    <?php endif;?>
    
    <?php if( $this->element->get_data() ): ?>
        <?php foreach( $this->element->get_data() as $key => $attr_value ): ?>
            data-<?php echo esc_attr( $key )?>="<?php echo esc_attr( $attr_value );?>"
        <?php endforeach;?>
    <?php endif;?>
    
    />
    
    <?php include( eo_locate_template( 'eo-booking-form-description.php' ) ); ?>
    
    <?php include( eo_locate_template( 'eo-booking-form-errors.php' ) ); ?>
    

    I know it miss function is_valid( $input ) on my EO_Booking_Form_Element_File class… And after I’ll should to add data in the mail…

    I think I have to create some other templates to have some configuration fields in admin. And my controler register command should be false…

    The difficult is to not have some guide line to not forget some steps… I discover them I discovered progressively.

    #19765

    Marc FRÈREBEAU

    I see we should create new field type by derivate EO_Booking_Form_Element class.
    => http://wp-event-organiser.com/blog/tutorial/using-form-api-add-additional-fields/

    But This tuto doesn’t explain this part of the job… :-/
    What are the steps to create new file type as “file” ?

    #19737

    Marc FRÈREBEAU

    Hi Stephen,
    <br><br>
    Thanks for this very good plugin !
    <br><br>
    I’m in EO V2.13.6 And EO-pro V1.11.0 and I already the bug with non saved booking form title.

    Pendding, as Mikko, I use eventorganiser_booking_title filter to change it.
    <br><br>
    Just another info : the doc (http://codex.wp-event-organiser.com/hook-index.html) doesn’t show the eventorganiser_booking_title filter hook.

    The search engine in the same page don’t work for me (with Firefox 41.0.2 for ubuntu).
    <br><br><br>
    Best regards,

    #19728

    Marc FRÈREBEAU

    Hi

    Can I add an input type file in booking form ?
    The aim is to save 3 files and add them in attached files to the administrator email.

    If plugin can’t do it, which hook I better use to develop it ?

    #19721

    Marc FRÈREBEAU

    On this page http://docs.wp-event-organiser.com/bookings/selling-your-first-ticket/
    There is a break link in § “Step 3: (Optional) Creating custom booking fields”
    => “booking form customiser” : http://docs.wp-event-organiser.com/bookings/selling-your-first-ticket/Custom_Booking_Forms

    #19612

    Frank Dandenell

    Hi, I may have found a work around that suits me at least, hopefully a few others.

    Instead of using the venue function, I add the venue to the ticket name. This way I get one event with multiple dates and venues, and the date and venue are tied to each other.
    And when an event date is passed, the ticket can be hidden automatically, along with the venue.

    But, since I have a great handicap in php, I need some assistance in how to
    call the ticket names for each event, and display them in a widget.

    I know the ticket names are listed in the booking form but I would like to display them outside of the booking form, alongside with some other info.

    Stage 2 . would it also be possible to list these ticket names by their corresponding event, in the event calendar?
    Then today would be Christmas Eve 😉

    Best regards, Frank

    #19508

    Stephen Harris

    Absolutely, only events for which you create tickets will display a booking form.

    #19507

    Paul Scollon

    Sorry if this has been asked before. I am wondering if certain events can NOT have a booking form when using this extension. Not all events might require registration, so I would want to show NO booking information on these events. Possible?

    #19473

    In reply to: Custom Event Page PHP?


    Stephen Harris

    Hi Cindy,

    By default if your theme doesn’t have a single-event.php the plug-in uses single.php and inserts the event data before the content.

    You can create a custom event template by creating a single-event.php in your theme. Then, to include the meta data template on the single event page simply add the line

     <?php eo_get_template_part( 'event-meta', 'event-single' ); ?>
    

    wherever you want that content (event date, venue map etc) to appear. More details about templates can be found here: docs.wp-event-organiser.com/theme-integration/

    By default the booking form is added immediately after the event content, you can change that location as outlined in this thread: http://wp-event-organiser.com/forums/topic/move-booking-form-to-different-location-on-page/

    Hope that helps!

    #19472

    Cindy Fry

    Hi Stephen,

    It looks like the Event page (that contains the Booking form) uses the standard WP “post” php file. We would like to not have certain blocks on the Event page, and wondered if it was possible to have the Event page use a different php file, specifically, one that didn’t have:

    1. The Date & Comments section right under the Event title, and
    2. The Posting Date block & Comments comment at the bottom of the page,
      under the Pay button.

    Thanks for your help,
    Dave

    #19426

    Stephen Harris

    Thanks, I’ll look into that for you.

    I add fields to the fieldset (they should be under & indented, correct?),

    Yes – in the booking form customiser fields added inside a fieldset are denoted by being indentended and immediately beneath that fieldset.

    There is not a border around them, nor do they appear any different than any of the other fields on the form. Am I doing something wrong?

    I’m afraid styling will depend on the theme in use. You could always add styling with a few lines of CSS to your theme’s style.css:

    fieldset.eo-booking-field-fieldset {
          border: 1px solid #c0c0c0;
          margin: 0 2px;
          padding: 0.35em 0.625em 0.75em;
    }
    

    Glad to hear the plug-in is working well for you – I’ll definitely take the feedback regarding a summary page on board.

    #19425

    Cindy Fry

    Hi Stephen,

    Thanks for your reply.

    First, on the Bookings Export, it appears that the fields that are not being exported in the CSV file (even though they ARE in the “Select booking fields to be included in export”) are all the fields within the “Fieldset”.

    Which brings up a question: I don’t see the purpose of the “Fieldset” choice. I add fields to the fieldset (they should be under & indented, correct?), and then add another Fieldset at the bottom of the list, but I fail to see anything that sets them apart in the Booking form. There is not a border around them, nor do they appear any different than any of the other fields on the form. Am I doing something wrong?

    On the Drop-down question, I just found out that if I click on one of the titles of a booking, it sorts the list to give me only that Event’s bookings. Didn’t realize that. Sorry for the confusion, as that works very well.

    And on the Bookings Overview page, I see what you mean about the “No confirmed attendees / 4 Bookings” listing at the top right of the list. That’s a good way to get a quick view. But it still would be great if there was just a page that gave an overall of the Attendees / Bookings / Pending / list of names of attendees. Maybe this could be something that could be turned on or off in the Admin section, for those that might have thousands of attendees, but for those of us that would have less than 50, this would be a great tool.

    Thanks for your help – and still thing this is the most comprehensive plugin out there!! Great work!

    Cindy

    #19400

    Cindy Fry

    I have checked all the field choices (after I select “Export Bookings”), but the resulting csv file doesn’t contain all of the fields from the booking form.

    I think that the “Manage Bookings” function can use some better reporting features:

    1. First, it would be better to have a drop-down to select which
      booking you would like to see, instead of a text box where we have to
      enter the title

    2. It would also be great if you could click on the event, and a page
      would open that has an overview of the event: how many people
      booked, how many are confirmed, how many are pending, etc. It’s a
      pain to have to download a csv every time, when all the info is in
      the plugin database.

    Thanks for your help on the first subject, and thanks for a great plugin!!

Viewing 15 results - 436 through 450 (of 932 total)