Support

Home Forums Event Espresso Premium venue_city in widget

venue_city in widget

Posted: February 8, 2013 at 9:34 am

Viewing 6 reply threads


inlinewo

February 8, 2013 at 9:34 am

Helle all,

Has anyone succeeded in having the venue_city field getting listed in the widget?
I have been trying to do so by copying over all what seemed to be relevant lines from the event_list_display.php to the widget.php, but without succes.
Is someone has succeeded in getting this working, please share!


Dean

February 11, 2013 at 4:16 am

Hi,

The upcoming events widget was not designed to display the venues and it is self contained code (so wont take code from the generally event list) so you would need to modify the code.

It does a database search to get the info but its not requesting the venue info.

On line 61 approx it says

$sql = "SELECT e.*, ese.start_time FROM " . EVENTS_DETAIL_TABLE . " e ";

replace that (comment it out for now) with

$sql = "SELECT e.*, ese.start_time";
$sql .= ", v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta ";
$sql .= "FROM " . EVENTS_DETAIL_TABLE . " e ";

Then you can just use

<?php echo $event->venue_city; ?>

to actually display the venue city


inlinewo

February 13, 2013 at 2:26 am

Hi Dean,

It turns out this piece of code doesn’t work. There is no output at all, maybe because I am using the venue manager?

The original cut-and paste action I did with a piece of code from events-list.php broke the selection of categories the widget offers, so using that piece of code also is not an option.

Any suggestions on how to resolve this will be very welcome!


inlinewo

February 13, 2013 at 9:44 am

For those interested, i fixed this issue by replacing the code starting at line 49 with the following (actually, I wanted to show 3 fields extra: end_time, venue_city and a thumbnail):

            if (isset($type) &amp;&amp; $type == 'category') {
            $sql = "SELECT e.*, c.category_name, c.category_name, c.category_desc, ese.start_time, ese.end_time, v.city FROM " . EVENTS_CATEGORY_TABLE . " c ";
            $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.cat_id = c.id ";
            $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = r.event_id ";
            $sql .= " LEFT JOIN " . EVENTS_START_END_TABLE . " ese ON ese.event_id = e.id ";
            $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id " ;
            $sql .= " WHERE c.id = '" . $instance['category_name'] . "' ";
            $sql .= " AND e.is_active = 'Y' ";

Next include the following lines under $event->start_date = isset($event->start_date) ? $event->start_date : ”;

                $event-&gt;end_date = isset($event-&gt;end_date) ? $event-&gt;end_date : '';
            $event-&gt;event_city = isset($event-&gt;city) ? $event-&gt;city : '';
            $event_meta = unserialize($event-&gt;event_meta);
            $event_img_url = $event_meta['event_thumbnail_url'];

Lastly include echo lines with the above used variables and you are done.

Maybe it is of help to someone.


Dean

February 13, 2013 at 11:54 pm

Hey,

Really sorry I couldn’t get back to you earlier.

Glad you found a resolution though and thanks for posting it!


inlinewo

February 15, 2013 at 5:46 am

I can send you the complete working widget file if you like, it includes start+end time, thumbnail and city.


Dean

February 15, 2013 at 9:46 am

Hey

Sure thing i’d love to look at it, feel free to email in (support @ eventespresso.com) or place it on paste bin.

Viewing 6 reply threads

The support post ‘venue_city in widget’ 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