Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

ecommerce default country

Go to End

6 Posts   3938 Views


2 Posts

16 October 2007 at 12:37pm

first, thanks for a fantastic piece of open source software.

second, after much searching, I am unable to find where the ecommerce module defaults to "new zealand" for the country in the code. I would like to change it, but can't seem to locate where to change it.

thanks in advance


Forum Moderator, 922 Posts

16 October 2007 at 5:15pm

Hi there,

Thanks for the kind words.

I believe what you're after is this line of code new DropdownField('Country', 'Country', Geoip::getCountryDropDown(), self::findCountry()). It can be viewed in the source browser at:

Change your EcommerceRole.php in your site so that the 4th argument to the DropdownField self::findCountry() is removed. This should stop the country dropdown from populating a default country. If there are any other instances of the site where a country is defaulting, just do a search on all ecommerce php files for findCountry() or Geoip::visitor_country( in all files.

Originally this was in place so if you're a member, it used your member's country as the default in the dropdown. Otherwise, if you're not a member, or the country hasn't been set in your member preferences, it attempts to find what country you're from based on IP address.

Hope this helps!



2 Posts

16 October 2007 at 11:49pm

Thanks for the quick reply Sean!

I will dig into the code tonight. I appreciate the help.

Keep up the good work.


Community Member, 199 Posts

24 September 2008 at 9:54pm

Hi Sean, Instead of just eliminating the self::findCountry() code is it possible to actually change the default from 'New Zealand' to another country?

Thanks in advance.


Community Member, 7 Posts

4 October 2008 at 6:54am

Edited: 04/10/2008 6:54am


To change the default country, open sapphire/security/Geoip.php
then put the desired 2 digit country code in line 289

		if(substr($address,0,7)=="192.168" || substr($address,0,4)=="127.") {
			// default country updated by Daniel Kratohvil
			$code = "US";	// default country :)
		} else {



Community Member, 199 Posts

7 October 2008 at 1:11am

Perfect. Thanks Daniel!