Jump to content

1.6.1.0 : Undefined Index Error In Country.php?


Recommended Posts

Hi All

 

After upgrading from 1.6.0.14 to 1.6.1.0 I noticed this error pop up above the top banner.

Turns out that the error reporting condition was written as "true" in the new defines.inc.php installed during the upgrade.

 

Anyway, the error it reported is as follows:-

Notice: : id_country in /public_html/classes/Country.php on line 171

 

In Country.php from around line 151 I see this routine and have marked line 171 in bold red:-

 

 

/**
     * Get a country ID with its iso code
     *
     * @param string $iso_code Country iso code
     * @param bool $active return only active coutries
     * @return int Country ID
     */
    public static function getByIso($iso_code, $active = false)
    {
        if (!Validate::isLanguageIsoCode($iso_code))
            die(Tools::displayError());
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
            SELECT `id_country`
            FROM `'._DB_PREFIX_.'country`
            WHERE `iso_code` = \''.pSQL(strtoupper($iso_code)).'\''
            .($active ? ' AND active = 1' : '')
        );
      
 return (int)$result['id_country'];
    }

    public static function getIdZone($id_country)
    {
        if (!Validate::isUnsignedId($id_country))
            die(Tools::displayError());

        if (isset(self::$_idZones[$id_country]))
            return self::$_idZones[$id_country];

        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
        SELECT `id_zone`
        FROM `'._DB_PREFIX_.'country`
        WHERE `id_country` = '.(int)$id_country);

        self::$_idZones[$id_country] = $result['id_zone'];
        return (int)$result['id_zone'];
    }

 

 

Anyone have any thoughts on how to fix it?

 

Thanks

deepee

 

Link to comment
Share on other sites

  • 3 weeks later...

I have the same error moving from 1.6.0.9 to 1.6.1.0.  It looks very similar to the $price error that I managed to resolve going through the forum, but this is the only post related to this error I have seen.

 

Also using the old country.php does not resolve the error, the line count simply changes from line 171 to line 169 due to the lines in the code.

Link to comment
Share on other sites

I think that error will be seen by a lot of people if they turn on error reporting after the uprgrade.

I tried to log it as an issue in Forge on the day I started this thread but had problems with Forge itself!

I logged it again today and this time it worked.

Let's see what comes back....

Link to comment
Share on other sites

Thank you for the updates.... my logs are filling up nicely and some of my clients have trouble specifying addresses when signing up.  Take a couple of shots for the address to be saved and sometimes even just loops on the address field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...