Home › Forums › Calendar Products › Community Events › drop down for provinces in Add Events
- This topic has 4 replies, 2 voices, and was last updated 11 years, 8 months ago by
Barry.
-
AuthorPosts
-
July 2, 2014 at 9:06 am #267576
Tran
ParticipantI am trying to customize my venue.php and tribe-view-helpers-class.php files so that when users ‘add events’ they can select a country (2 options available canada and unites states), and depending on their choice a drop down will appear with states (which it already does), and if they choose canada, a drop down will appear with provinces.
Ive added a loadProvinces() into tribe-view-helpers-class.php, that has all the canadian provinces in it. And Ive added to the venue.php
<select class=”chosen” id=”StateProvinceSelect” name=”venue[Province]”>
<option value=””><?php _e( ‘Select a Province’, ‘tribe-events-community’ ); ?></option>
<?php foreach ( TribeEventsViewHelpers::loadProvinces() as $abbr => $fullname ) {
echo ‘<option value=”‘ . esc_attr($abbr) .'” ‘;
selected( $venue_province == $abbr );
echo ‘>’. esc_html( $fullname ) .'</option>’. “\n”;
} ?>
</select>However, it only shows up when the United States are selected, and will not show up if you select Canada… where in this file, is the limiter that either hides or makes visible the united states dropdown menu, and how can I get my provinces to show up for Canada?
July 3, 2014 at 2:13 am #270034Barry
MemberHi!
Though we can’t offer too much assistance with customizations like this one I’d be happy to point you in the right direction if I can. Can you provide a little more context, though? Are you trying to achieve this in the (Community Events) submission form, or the admin environment generally, or both?
Thanks!
July 10, 2014 at 9:47 am #335980Tran
ParticipantThe community events submission form,
thanksJuly 11, 2014 at 6:39 am #347821Barry
MemberOK, so the first thing here is to read up on the process of overriding templates – this and more is detailed in our Themer’s Guide and is well worth a read.
From there you will probably want to setup a custom version of the community/modules/venue.php template (and this would live within your theme’s tribe-events directory). Find the following line of code:
<input id="StateProvinceText" name="venue[Province]" type="text" name="" size="25" value="<?php echo ( isset( $venue_province ) && $venue_province != '' && $venue_province != -1 ) ? esc_attr($venue_province) : ''; ?>" />Replace it with something like this, adapting it to your specific use-case:
<select id="StateProvinceText" name="venue[Province]"> <option value="rgn1"> Region one </option> <option value="rgn2"> Region two </option> <option value="rgn3"> Region three </option> </select>(Naturally you would need logic to pre-select whichever province might already have been selected.)
I hope that gets you on track – and good luck 🙂
August 26, 2014 at 8:39 am #701627Barry
MemberHi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!
-
AuthorPosts
- The topic ‘drop down for provinces in Add Events’ is closed to new replies.
