help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

Get rid of Continent > Country selection in search header

Get rid of Continent > Country selection in search header

7 years 6 months ago
#23872
Hi, any way (also willing to edit php source files or JS) to get rid of the "choose continent" > "choose country" selections before drilling down to "cities"? We only list events in our country so it does not make sense for our users to drill down to that country each time they search an event. How can we possibly start with out country pre-selected, and the "city" select menu already populated? Any ideas of how this could be achieved?
Thanks,
Sebastian
The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: Get rid of Continent > Country selection in search header

7 years 6 months ago - 7 years 6 months ago
#23873
So, i tested something with clear javascript.

Add this code in the search view "default_table".
Code:
<script type="text/javascript"> function setDefaultContinentCountry() { var node = null; node = document.id('filter_continent'); if (node != null) { node.value='EU'; } node = null; node = document.id('filter_country'); if (node != null && node.value != 'DE') { node.value='DE'; document.getElementById('adminForm').submit(); } } window.onload = setDefaultContinentCountry; </script>
This will submit the form once to simulate the selection of contintent and country. The submission is required otherwhise the city selection box would not contain any cities. But if you have too many events, this solution may be very slow.
Change in the given code 'EU' and 'DE' to you continents/countrys shortcuts.

Hint: With this solution it is not possible to find events that don't have a venue. Events without venues are only shown if not continent/country is selected.

Hint: You can hide the row via javascript. For that I would give the <tr>-element an id. Eg. continentTableRow and countryTableRow.
Then change the javascript to:
Code:
<script type="text/javascript"> function setDefaultContinentCountry() { var node = null; node = document.id('filter_continent'); if (node != null) { node.value='EU'; document.id('continentTableRow').style.display= "none"; } node = null; node = document.id('filter_country'); if (node != null && node.value != 'DE') { node.value='DE'; document.getElementById('adminForm').submit(); } if (node != null) { document.id('countryTableRow').style.display= "none"; } } window.onload = setDefaultContinentCountry; </script>

If you use the JEM Responsive overrides give me that information and i will help you integrating this solution to JEM Responsive.
Last edit: 7 years 6 months ago by Egnarts.
The following user(s) said Thank You: sebastian, jojo12

Please Log in or Create an account to join the conversation.

Re: Get rid of Continent > Country selection in search header

7 years 6 months ago
#23884
Hi Egnarts,

thank you very much for this solution, I appreciate it very much that you took the time to come up with this javascript trick.

It it is a nice idea and mostly works, but only after the first form submission.

If you take a look at
www.biergartenfreunde.de/events/veranstaltungs-suche.html
initially the "City" select menu is not visible. But if you then choose some option from the "category" select, then after the page reload the "City" menu becomes visible. Is there any way we can have "City" visible on the first page load?

Thanks again for your great input!

Please Log in or Create an account to join the conversation.

Re: Get rid of Continent > Country selection in search header

3 years 11 months ago
#27862
I too have this query. I would like to start with CHOOSE CITY instead of CONTINENT.

All of our events are from one country and it will appear odd to our readers to choose a continent.

I have read the assistance Egnarts offered to sebastian in this thread and I can see that three years ago sebastian said the solution only works after the first submission. I have visited sebastian’s site and can see the default on his site is still Continent.

I’d be grateful for a solution suggestion. Thank you in advance.

Attachments:

The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: Get rid of Continent > Country selection in search header

3 years 11 months ago
#27863
I agree, in the settings we can choose the country, so the searchshouldbe able to use this as default.

Please Log in or Create an account to join the conversation.

Re: Get rid of Continent > Country selection in search header

3 years 11 months ago - 3 years 11 months ago
#27864
jojo12 wrote: in the settings we can choose the country, so the searchshouldbe able to use this as default.

Yes, and if a significant reworking of the coding is required for this and is problematic (I am not a coder) then perhaps:
1) JoJo's suggestion of setting the COUNTRY as a default
2) Triggers a CITY dropdown (attachment)
3) Then just HIDE the display of CONTINENT and COUNTRY

Is that viable?

Attachments:

Last edit: 3 years 11 months ago by Andano.

Please Log in or Create an account to join the conversation.

Time to create page: 0.537 seconds