Custom Select Field

Home Forums Ticket Products Event Tickets Plus Custom Select Field

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1300248
    Mike
    Participant

    Hey everyone! So i am fairly new to customizing the The Events Calendar. I have the TEC Pro with Events Tickets Pro. I found the place to customize the select field event-ticket-plus > src > views > meta > select.php.

    i am creating a website for a client who is putting together a car show events website. the participants can submit their cars they have in stock and showcase them on their profiles.

    I’ve written a php function that dynamically pulls their car information and makes them into options for a dropdown form using the information they provided in that list in a foreach loop.

    so my question is…how do I create my own select.php without having to override the current template? I want to have those drop downs as they register for each ticket without having to manually input there cars in a regular text box (the client is adamant about this feature).

    here is my code. Right now i have it as a shortcode for testing purposes!

    function getcarsdata() {
    	$user_id = wp_get_current_user();
    	$cars = bp_get_profile_field_data('field=Cars&user_id='.bp_loggedin_user_id());
    	
    	$car = explode('|', $cars);
    	echo '<h2>Testing loop</h2> <form><select>';
    	
    	foreach($car as $key =>$carname) {
    		
    		echo '<option value="'.$carname.'"> ' .$carname. '</option>';
    		
    	}
    	echo '</select></form>end of loop';
    }
    add_shortcode ('usercars', 'getcarsdata');
    #1301400
    Cliff
    Member

    Hi, Mike.

    Thinking outside any current limitations, my suggestion would be to use a custom post type, like “user-cars” and then let each user add their own “posts” to this custom post type, and then you could have an Attendee Information field specific to their “user-cars” posts. This would allow them to edit the posts, add new (bought new car), delete (sold car), etc.

    However, I don’t think this functionality is currently possible. Here are my thoughts:

    • /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Field/Abstract_Options_Field.php would like be utilized
    • but /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Field/Abstract_Field.php __construct() isn’t filterable and therefore that list of field types is hard-coded (unless you want to try to override this entire class or its constructor)

    Instead of that, you might be able to do the select.php template override like you have been and then detect which field you’re on and say “if currently rendering User Cars field, load this <select>, else load the default <select>”

    I think that last option should work for you.

    Please let me know how this goes.

    #1302480
    Mike
    Participant

    yeah thats what i am thinking now after looking at how all this works. it might be easier that way than trying to force it. now i just got to have the template work

    #1303223
    Cliff
    Member

    I’m glad I could help (at least I think I did) in some way.

    There’s currently a known bug that overriding the files in the /wp-content/plugins/event-tickets-plus/src/views/meta/ directory will not work, unfortunately.

    I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. I cannot guarantee when it will be fixed as it’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.

    I apologize for this issue and appreciate your understanding and patience.

    #1316503
    Mike
    Participant

    any word on the bug issue relating to this template override issue with the meta field?

    #1319631
    Cliff
    Member

    Mike, I had to check with our developers and was told it’s on the soon-to-do list. Other than that, I can’t provide more information because we do not provide ETAs.

    #1329135
    Victor
    Member

    Hello Mike!

    Just replied to your other thread but also wanted to share it with you here: A new maintenance release (for the Week of 24 July 2017) is out, including a fix for this issue 🙂

    Find out more about this release → https://theeventscalendar.com/maintenance-release-week-24-july-2017/

    Please update the plugins and let us know if the fix works for your site.

    Best,
    Victor

    #1339187
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Custom Select Field’ is closed to new replies.