help to better help you:

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

State and abbreviations How I did it..

State and abbreviations How I did it..

11 years 1 month ago
#11499
So I was frustrated at having the venues with full state names and than a search for NE not only got me Nebraska also got me New York, New Jersey and others..

So what I did was I changed all my states to Full state names..

I added a field called abbrev and then set it to the abbreviation matching the state

Than in my model for view type I replaced case 5 in the search filter switch..
Code:
if (strlen($search) != 2 ){ $where[] = ' LOWER(l.state) LIKE \'%'.$search.'%\' ';}else{$where[] = ' LOWER(l.abbrev) LIKE \'%'.$search.'%\' ';}

So now if a person searches for the 2 character they will search the abbrev field not the state.

Is this proper coding NO, but it solves a problem I have had.
JEM 2.0.1 - J3.3.3 PHP 5.4.4 NGINX!! | www.usyw.org
The following user(s) said Thank You: ernst67

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

Time to create page: 0.394 seconds