Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Bug in GeoCityLite support

Bug in GeoCityLite support

Hello
I have newly installed MetaMod and MetaModPro version 13 (nov 26, 2012) from today.
My question: what am I doing wrong?
In intend to publish different modules in different spanisch cities.

This is the configuration of my MetaMod 204

Basic Options
MetaMod v3.13, 2012-11-26
MetaMod Pro plugin v3.13, 2012-11-26 is installed and enabled.
JomGenius v14 is provided by MetaMod

Quick module position or id include: 203

GeoIP

GeoIP Check   
geoip/GeoIP.dat found. GeoIP Country features enabled.
geoip/GeoLiteCity.dat found. GeoIP City/region features enabled.

Enable GeoIP/GeoCity:     GeoLite City (free)
IP override: 217.71.195.41 (this is my IP; once with, once without: no difference)
Only these countries: ES

under PHP

$fromCountryId = "ES"
$geoip->region = ES,56,"Catalonia" (trial with and without, same result)
$geoip->city = "Barcelona"

Result: a white screen

When I change city to country under GeoIP Enable, then the page displays and the module also.
But the the intention is to use geoip city!!

jansan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Thanks for the bug report. I found the bug in the GeoLiteCity support, and have released a new version: 3.13b. You can now download this from your account.

Now,  just checking with you: in the PHP code that you quoted above, I assume that is not the complete PHP code, and just a portion of it? You will need to structure it something like this:

if ($geoip->city == 'Barcelona') return XXX;
// replace XXX with module id of the module to display for Barcelona.

The other thing, and this is important, is that the GeoLiteCity support is completely dependent on the accuracy of the GeoLiteCIty database. And this is NOT very accurate, in most countries.

e.g. for the IP address you gave above, it does NOT provide a city/postal code/metro code/area code. You can find out more info on accuracy for different countries here: http://www.maxmind.com/en/geolite_city_accuracy where it shows that Spain has only 61% accuracy of city detection within 40 km.

I have a feeling this is just not going to be accurate enough for you - sorry.

Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

metamodguy wrote:

Thanks for the bug report. I found the bug in the GeoLiteCity support, and have released a new version: 3.13b. You can now download this from your account.

Hello Stephen,

I have not installed yet...only downloaded purchases from yesterday. IS this a file I will need to update please?

Jim

IamJim
Beginner Modder
ranks
useravatar
Offline
7 Posts
User info in posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Hi Jim,

if you purchased yesterday then you should download MetaModPro again to get the version with a couple of bugfixes.

• Go to your “My Account” page http://www.metamodpro.com/shop/account
• Log in with your username and password
• Click on “View” next to your confirmed order
• Scroll down past the invoice until you see the Order Items section
• Click on MetaModPro-XX.zip to download it.


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Hi Stephen,

Have downloaded metamodpro 13b version and ... blank screen does not show up anymore!
Already contacted before template forum (checking php memory limit, then hosting provider not seeing any error logs), so this is solved now, fine!
I checked the maxmind accuracy page, is important to know anyway! Hope accuracy will be sufficient!

A further question:
1. when using regions, does one have to enable country db or city db?
2. do you know if the maxmind purchase city version is more accurate?

I go now on further trying out the correct code.
Thank you for your support.
Jan

jansan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Hi Jan,

For regions, you have to use the City db.

The paid-for version is more accurate, but not a whole lot more. Look for a table of accuracy for the Paid-for version on the Maxmind web site to compare.

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Hello Stepehn,

I think I have sent a question a few days ago, but I do not find it back.
So now, there I go.

I only need two different modules for now in Spain: one in Barcelona, another in Valencia. These are the two largest cities from 3 (the other is Madrid9 in Spain. So I guess the accuracy of GeoLiteCity should be sufficient.
I have entered following code in the metamodpro PHP field:
if ($geoip->city == 'Barcelona') return 214;
if ($geoip->city == 'Valencia') return 215;
but it does not seem to work: both modules appear!

Q1: is this code sufficient and correct; should I indicate ES for Spain
Q2: when cities do not work, can I use the regions (I have downloaded somewhere these in the link you have indicated), do I have to enable then GeoLiteCity or GeoCountry?
Q3: do you know if the paying GeoLiteCity is more accurate.

Thank you for answering
Jan

jansan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Bug in GeoCityLite support

Hi Jansan,

sorry for the very slow reply - I have been out of town for 10 days and was not able to work on any forum requests while I was away.

1 - the code is sufficient. As long as the city names are unique (i.e. as long as there is only 1 Barcelona in the world) you're fine.

2 - you can mix and match cities and regions. This is a very good idea. With the style of code you are using above, just check for the cities first, then the regions after that, then the PHP will check each of the cities or regions until one matches. Use the GeoLiteCity database for this.

e.g.
if ($fromCountryId == 'ES') {
  if ($geoip->city == 'Barcelona') return 214;
  if ($geoip->city == 'Valencia') return 215;
  if ($geoip->region == 56) return 214; // Catalonia
  if ($geoip->region == 51) return 215; // Andalucia
}

The region data is:

ES,07,"Islas Baleares"
ES,27,"La Rioja"
ES,29,"Madrid"
ES,31,"Murcia"
ES,32,"Navarra"
ES,34,"Asturias"
ES,39,"Cantabria"
ES,51,"Andalucia"
ES,52,"Aragon"
ES,53,"Canarias"
ES,54,"Castilla-La Mancha"
ES,55,"Castilla y Leon"
ES,56,"Catalonia"
ES,57,"Extremadura"
ES,58,"Galicia"
ES,59,"Pais Vasco"
ES,60,"Comunidad Valenciana"

... where the 1st 2 letters are the country code, the numbers are the region code (which must be taken in conjunction with the region code), and the name is the name of the region.


3 - The paying GeoLiteCity database is more accurate, but not a whole lot more. Search the MaxMind website for accuracy data (sorry I don't have a link for it to hand).

4 - if both modules are showing up, then it's not because of MetaMod. You need to disable the "target" modules so they do not show up until/unless the MetaMod includes them. See the Quick Start guide for details: http://www.metamodpro.com/metamod/quick-start

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4388
Newest User:
wilmer7878
Members Online:
1
Guests Online:
199

Online: 
wilmer7878

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked