Hi, same nightmare for me too, prestashop 1.4.8.2, paypal module v3.8.1
I have solved in this way.
The problem is due to this tossic function in the class State.php
public static function getIdByIso($iso_code)
{
return Db::getInstance()->getValue('
SELECT `id_state`
FROM `'._DB_PREFIX_.'state`
WHERE `iso_code` = \''.pSQL($iso_code).'\''
);
}
It looks for the first value of iso_code, that is unique just for a country, not for all the countries.
I have created in the class State.php a new function, in red what I have added
public static function getIdByIso_new($iso_code, $id_country)
{
return Db::getInstance()->getValue('
SELECT `id_state`
FROM `'._DB_PREFIX_.'state`
WHERE `iso_code` = \''.pSQL($iso_code).'\' AND `id_country`='.$id_country
);
}
Then I modified the file payment.php of the paypal module
I have just changed the function getIdByIso with getIdByIso_new, so changed this ...
if (Country::containsStates($address->id_country))
$address->id_state = (int)State::getIdByIso($ppec->result['PAYMENTREQUEST_0_SHIPTOSTATE'], $address->id_country);
... into this
if (Country::containsStates($address->id_country))
$address->id_state = (int)State::getIdByIso_new($ppec->result['PAYMENTREQUEST_0_SHIPTOSTATE'], $address->id_country);
I hope it could be helpful for someone.
Stefano