Adding a city class to the database

Discussion in 'Customizations' started by EnergyFreak, Aug 9, 2010.

  1. EnergyFreak Customer

    Hi,

    I would like to manually add a city class to the database. I am not sure if most people that had selectable cities from their sign up forms is how they did it, but I think this might a good way to do it without using a whole bunch of html. I basically need the mysql queries needed to insert cities into my class_cities including all the varchars or ints it requires for it to function correctly. I am still looking at guides on how to accomplish this. I am also studying our current database to see f I can just copy the state class and modify it.
  2. EnergyFreak Customer

    I am starting to think that I would need the developpers version to add cities as a drop down instead of a text input... Because the states has the command showStates which I am guessing it goes and gets the states somewhere. I have tried to do the same for cities but it fetches nothing, even if I have created a class called cities and manually added some cities in the class. Can anyone confirm that this is possible?
  3. seymourjames All Hands On Deck

    You might be able to just define a dropdown with fixed options (the list of cities). I am guessing you have a fixed list of cities which you would like people to register against.
  4. EnergyFreak Customer

    You mean like replacing this:

    <label for="city">{if $req_city=="Y"}<span class='required'>{$smarty.const.LANG_STAR}</span>{/if}{$smarty.const.LANG_USER_CITY}{$smarty.const.LANG_COLON}</label>
    <input {if $req_city=="Y"}class="required"{/if} name="city" type="text" id="city" value="{$city}" size="{$smarty.const.FIELD_SIZE}" />

    with this:

    <select>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
    </select>
  5. Mike-N-Tosh Developer & Moderator

    That would be how you make a drop down list, but I don't know about the names of those cities. I've never heard of any of those cities.
  6. EnergyFreak Customer

    That is because they are awesome cars

    This is what I have so far and it is giving me a blank page:

    <label for="city">{if $req_city=="Y"}<span class='required'>{$smarty.const.LANG_STAR}</span>{/if}{$smarty.const.LANG_USER_CITY}{$smarty.const.LANG_COLON}</label>
    <select name="city" id="city" {if $req_city=="Y"}class="required"{/if}>
    <option value="none"{if $city=="none"} selected="SELECTED"{/if}>{$smarty.const.LANG_STATE_NONE}</option>
    <option value="Montreal" selected="SELECTED">Montreal</option>
    {/section}
    </select>
  7. seymourjames All Hands On Deck

    Yes pretty much like like that. You probably just have an error in the logic or you are missing a closing brace.

Share This Page