Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

Get rid of Continent > Country selection in search header 3 years 8 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.

Get rid of Continent > Country selection in search header 3 years 8 months ago #23873

  • Egnarts
  • Egnarts's Avatar
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 272
  • Karma: -3
  • Thank you received: 114
So, i tested something with clear javascript.

Add this code in the search view "default_table".
<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:
<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.
Take a look at the responsive version of JEM: The Responsive JEM
The following user(s) said Thank You: sebastian, jojo12

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

Last edit: by Egnarts.

Get rid of Continent > Country selection in search header 3 years 8 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.

Get rid of Continent > Country selection in search header 2 months 1 week 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.

Get rid of Continent > Country selection in search header 2 months 1 week ago #27863

  • jojo12
  • jojo12's Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 3334
  • Karma: 45
  • Thank you received: 363
I agree, in the settings we can choose the country, so the searchshouldbe able to use this as default.
on JEM 2.3.0 stable in latest Joomla (3.9.22) Protostar php7.4.5

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

Get rid of Continent > Country selection in search header 2 months 6 days 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:

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

Last edit: by Andano.
  • Page:
  • 1
  • 2
Time to create page: 0.610 seconds

Donate

If you find JEM useful and if you use it on your site, please consider a donation to the project.

Private Messages

You are not logged in.

Follow us......