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..

  • neyworg
  • neyworg's Avatar Topic Author
  • New Member
  • New Member
  • Thanks: 0

State and abbreviations How I did it..

12 years 8 months 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.

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

Time to create page: 0.503 seconds