Post by Johnathan » Tue Nov 23, 2010 5:47 am

I needed to create a "Continental U.S." geo-zone, and rather than change each geo-zone's country from Afghanistan (the first in the list) to United States, then choose the zone, I decided to change the default country that comes up when clicking "Add Geo Zone". It makes creating things much faster. Here's how:

IN:

Code: Select all

/admin/view/template/localisation/geo_zone_form.tpl
AFTER:

Code: Select all

'<option value="<?php echo $country['country_id']; ?>"
ADD:

Code: Select all

<?php if ($country['country_id'] == '223') echo ' selected="selected"'; ?>
If you need to make the default something besides the U.S., change the 223 to the country_id of your country.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by glolar » Wed Dec 22, 2010 8:22 pm

Johnathan,

I made the change, and Afghanistan is still the first name in the list. Here is the new line of code after your suggested change:

<option value="<?php echo $country['country_id']; ?>"<?php if ($country['country_id'] == '223') echo ' selected="selected"'; ?><?php echo $country['name']; ?></option>

Could you please post the entire OLD line of code and then the entire NEW line of code? I am obviously doing something wrong here. Sorry, but my PHP skills are weak.

Thank you.

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by Johnathan » Wed Dec 22, 2010 11:08 pm

I think the problem is that you didn't include the single-quote before the option tag (i.e. you need to search for '<option not <option). Here's a clearer edit to follow:

REPLACE:

Code: Select all

html += '<option value="<?php echo $country['country_id']; ?>"><?php echo addslashes($country['name']); ?></option>';
WITH:

Code: Select all

html += '<option value="<?php echo $country['country_id']; ?>"<?php if ($country['country_id'] == '223') echo ' selected="selected"'; ?>><?php echo addslashes($country['name']); ?></option>';

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by glolar » Thu Dec 23, 2010 1:25 pm

Thanks, Johnathan, that worked perfectly!

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA
Who is online

Users browsing this forum: No registered users and 9 guests