Support

Home Forums Event Espresso Premium Error loading Custom Template View

Error loading Custom Template View

Posted: November 30, 2019 at 1:43 am

Viewing 19 reply threads


ali west

November 30, 2019 at 1:43 am

Hi there
I’ve just updated my support licence for EE3 and have also updated the Custom Template add on. My site has been rebuilt into a Divi theme so I’m not sure if that’s causing the problem but I’m struggling to get the correct view working. I get the errors shown on this test page:

https://www.beachvolleyballinc.com/testbook

You’ll see there’s some kind of loop going on – not sure what I’ve done. If you could take a look – it’s the latest version of WordPress.

Thanks!


Tony

  • Support Staff

December 2, 2019 at 3:28 am

Hi there,

I’m not sure where that loop is coming from, it’s the whole page rather than EE’s output so likely something within the theme.

How is the shortcode being added to the page?

I’m guessing using a shortcode? If so can you post the full shortcode you are using?

Are you using a custom page template for that output?


ali west

December 3, 2019 at 3:30 am

Hi there

If I use this shortcode: [EVENT_CUSTOM_VIEW ]
The whole looping things occurs and the backend goes completely weird and removes any styling and all content from the dashboard is just a list. Even if I switch themes this happens (to TwentyNineteen)

If I remove this shortcode but just have this in: [EVENT_CUSTOM_VIEW template_name=”grid-view”] – it says The custom template grid-view can not be found – even if I switch to TwentyNineteen

I’ve removed the testbook page now but you can see this instead now – it’s a standard page, nothing custom:

https://www.beachvolleyballinc.com/booknew

Thanks for looking!


Tony

  • Support Staff

December 3, 2019 at 5:46 am

ok, your getting “The custom template grid-view can not be found” because there is no ‘grid-view’ template file.

The shortcode you need for the grid template is just:

[EVENT_CUSTOM_VIEW template_name=grid]

Does it work using that shortcode?


ali west

December 3, 2019 at 6:27 am

I’m afraid not it – it still says the same 🙁

Both version of shortcode are here but I still get the same error:

https://www.beachvolleyballinc.com/coaching-and-camps/availability


Tony

  • Support Staff

December 3, 2019 at 6:42 am

Have you installed the grid template?

You need both the EE3 Custom Templates Add-on and the Grid template add-on installed:

https://eventespresso.com/wiki/events-grid-view-template-add-on/#ee3installation


ali west

December 3, 2019 at 6:55 am

I wonder if that is the problem. It was installed as it used to work. Maybe somewhere along the line it’s been removed with the rebuild. Let me take a look…


ali west

December 3, 2019 at 7:06 am

Is this a premium plugin? Having looked at our old install I don’t think it was added as we didn’t need it. We just had a table view rather than a grid view. However when I use [EVENT_CUSTOM_VIEW ] it gives the returning loop error and the wordpress dashboard reverts to text only.


Tony

  • Support Staff

December 3, 2019 at 11:01 am

Is this a premium plugin? Having looked at our old install I don’t think it was added as we didn’t need it. We just had a table view rather than a grid view.

Yes, it’s a premium plugin and wouldn’t come included with the EE3 Personal license.

However when I use [EVENT_CUSTOM_VIEW ] it gives the returning loop error and the wordpress dashboard reverts to text only.

Hmm, this looks like an issue with Gutenberg and I think we’ll need to force the add-on not to preview in the editor as it doesn’t support it.

Can you test adding a max_days param to the shortcode on your site, please?

Something like: [EVENT_CUSTOM_VIEW max_days=30]

Does the frontend output work then?


ali west

December 3, 2019 at 12:40 pm

Awesome, that’s now working 🙂 Thank you!


ali west

December 3, 2019 at 1:42 pm

Just one quick extra question – I notice on the table that I see here:
https://www.beachvolleyballinc.com/coaching-and-camps/availability

In my previous site I didn’t show the date or venue but there was a column with the number of spaces left eg 9/16 – how would I recreate that? Is it possible with a shortcode?


ali west

December 3, 2019 at 1:43 pm

And one more question – I’m using the Divi theme and builder – is it possible to use the builder when creating an event rather than the usual editor? I’m using EE3.
Thanks!


Tony

  • Support Staff

December 4, 2019 at 3:29 am

In my previous site I didn’t show the date or venue but there was a column with the number of spaces left eg 9/16 – how would I recreate that? Is it possible with a shortcode?

Sounds like you had a custom version of the table template as that data isn’t included by default.

Did you create a backup of the site before switching over?

If so, check in /uploads/espresso/templates/*template-name*/template.php on your old site’s files.

Or you may have the file within the theme:
espresso-template-{template_name}/template.php
{template_name}/template.php')

If not, you’ll need to re-create your custom template with whatever details you want to display/hide in that template.

Are you comfortable with PHP? The above is not possible with the shortcode.

And one more question – I’m using the Divi theme and builder – is it possible to use the builder when creating an event rather than the usual editor?

No, neither EE3 or EE4 support page builders at this time.


ali west

December 4, 2019 at 3:36 am

Thanks Tony. I’ll check out the old back up and see if I can spot it. If I do, would that be why I had the original shortcode – [EVENT_CUSTOM_VIEW template_name=”grid-view”] – not sure why else that would have been in there if I don’t have the grid add on! Or would the shortcode to pull it in still be the same?

Thanks for the info re the builder – save me trying to get it working with potential plugins etc.!


Tony

  • Support Staff

December 4, 2019 at 3:45 am

Possibly yes, if someone created a ‘grid-view’ template in either of the above locations the above shortcode would pull that template in and use it.

So for that instance of the shortcode, you’d be looking for /gird-view/template.php

That directory (and file) could be within /wp-content/uploads/espresso/templates/ or the sites theme.

The custom view addon gives you the shortcode [EVENT_CUSTOM_VIEW] shortcode and a few table template, then you can either have other custom template loading from plugins (like the Grid view plugin) or your own, using the template_name attribute.


ali west

December 4, 2019 at 2:44 pm

Hi again
I’ve found this file which was in folder called ‘grid-view’ within the old child theme:

<?php 
//Template: Grid View
//Description: This template creates a grid style view of events.
//Shortcode Example: [EVENT_CUSTOM_VIEW template_name="grid-view" max_days="30" category_identifier="concerts"].
//Requirements: CSS skills to customize styles, HTML/PHP to restructure.
//The end of the action name (example: "action_hook_espresso_custom_template_") should match the name of the template. In this example, the last part the action name is "grid-view",

add_action('action_hook_espresso_custom_template_grid-view','my_custom_template_grid_view');

function my_custom_template_grid_view(){

	global $this_event_id, $events, $wpdb;

	//Get the categories
	$sql = "SELECT * FROM " . EVENTS_CATEGORY_TABLE;
	$temp_cats = $wpdb->get_results($sql);

?>

<table id="ee_filter_table" class="espresso-table" width="100%">
	<thead class="espresso-table-header-row">
		<tr>
			<th class="th-group"><?php _e('Event','event_espresso'); ?></th>
			<th class="th-group"><?php _e('Available Spaces','event_espresso'); ?></th>

			<th class="th-group"></th>
		</tr>
	</thead>
	<tbody>
		<?php

      foreach ($events as $event){
		$button_text 		= __('Register &raquo;', 'event_espresso');
		$alt_button_text	= __('View Details', 'event_espresso');//For alternate registration pages
		$externalURL 		= $event->externalURL;
		$button_text		= !empty($externalURL) ? $alt_button_text : $button_text;
		$registration_url 	= !empty($externalURL) ? $externalURL : espresso_reg_url($event->id);
		if ( ! has_filter( 'filter_hook_espresso_get_num_available_spaces' ) ){
			$open_spots		= apply_filters('filter_hook_espresso_get_num_available_spaces', $event->id); //Available in 3.1.37
		}else{
			$open_spots		= get_number_of_attendees_reg_limit($event->id, 'number_available_spaces');
		}
		$live_button 		= '<a id="a_register_link-'.$event->id.'" href="'.$registration_url.'">'.$button_text.'</a>';
		$event_status 		= event_espresso_get_status($event->id);

		//Check for Multi Event Registration
		$multi_reg = false;
		if (function_exists('event_espresso_multi_reg_init')) {
			$multi_reg = true;
		}
		$cart_link 	= '';

		//Create an add to cart link
		if ($multi_reg && $event_status == 'ACTIVE' && empty($externalURL)) {
			$params = array(
				//REQUIRED, the id of the event that needs to be added to the cart
				'event_id' => $event->id,
				//REQUIRED, Anchor of the link, can use text or image
				'anchor' => __("Add to Cart", 'event_espresso'), //'anchor' => '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/cart_add.png" />',
				//REQUIRED, if not available at this point, use the next line before this array declaration
				// $event_name = get_event_field('event_name', EVENTS_DETAIL_TABLE, ' WHERE id = ' . $event_id);
				'event_name' => $event->event_name,
				//OPTIONAL, will place this term before the link
				'separator' => ' '.__("or", 'event_espresso').' '
			);

			$cart_link = event_espresso_cart_link($params);
		}

		if($open_spots < 1 && $event->allow_overflow == 'N') {
			$live_button = __('Sold Out', 'event_espresso');
			$cart_link = '';
		} else if ($open_spots < 1 && $event->allow_overflow == 'Y'){
			$live_button = !empty($event->overflow_event_id) ? '<a href="'.espresso_reg_url($event->overflow_event_id).'">'.__('Join Waiting List', 'event_espresso').'</a>' : __('Sold Out', 'event_espresso');
			$cart_link = '';
		}

		if ($event_status == 'NOT_ACTIVE') {
			$live_button = __('Closed', 'event_espresso');
			$cart_link = '';
		}

	   ?>
		<tr class="espresso-table-row cat-<?php echo $event->category_id; ?>">
			<td id="event_title-<?php echo $event->id?>" class="event_title"><?php echo stripslashes_deep($event->event_name) ?></td>
			<td id="venue_title-<?php echo $event->id?>" class="venue_title"><?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$event->id.'" type="available_spaces"]'); ?></td>

			<td class="td-group reg-col" nowrap="nowrap"><?php echo $event_status == 'ACTIVE' ? $live_button .  $cart_link : $live_button; ?></td>
		</tr>
		<?php } //close foreach ?>
	</tbody>
</table>
<script type="text/javascript">

jQuery(document).ready(function(){

	jQuery("#ee_filter_cat").change(function() {
		var ee_filter_cat_id = jQuery("option:selected").attr('class');
		console.log(ee_filter_cat_id);
		jQuery("#ee_filter_table .espresso-table-row").show();
		jQuery("#ee_filter_table .espresso-table-row").each(function() {
			if(!jQuery(this).hasClass(ee_filter_cat_id)) {
				jQuery(this).hide();
			}
		});
		if( ee_filter_cat_id == 'ee_filter_show_all') {
			jQuery("#ee_filter_table .espresso-table-row").show();
		}
	});

});

</script>
<?php
}


ali west

December 4, 2019 at 2:47 pm

The above seems to be the file I need as it’s got the info about number of attendees on. I’m not sure how to get it to work as it won’t work if I copy across to my new Divi child theme. Should it be there or in the uploads/espresso folder? The original file is called index.php within the grid-view folder. Thanks for any help with this, much appreciated!


Tony

  • Support Staff

December 5, 2019 at 4:07 am

The above template works fine for me within a child theme.

You would have that index.php file within /wp-content/themes/{your-divi-child}/grid-view/

Also, remove the double quotes around grid-view in your shortcode, it should be:

[EVENT_CUSTOM_VIEW template_name=grid-view]

Quotes are only required when there is a space in the attribute and can often cause problems.


ali west

December 5, 2019 at 4:23 am

Ahh that could have been the problem – all working now. Thank you so much! 🙂


Tony

  • Support Staff

December 5, 2019 at 4:44 am

You’re most welcome, I’m glad it’s working for you now 🙂

Viewing 19 reply threads

The support post ‘Error loading Custom Template View’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso