Serveur preprod f0c0c48223 first push
2016-04-14 16:14:31 +02:00

23 lines
519 B
PHP
Executable File

<?php
/*
** Zip Code Zone
** MARICHAL Emmanuel
** emmanuel.marichal@gmail.com
*/
class Address extends AddressCore
{
public static function getZoneById($id_address)
{
$address = new Address((int)$id_address);
$zone = Db::getInstance()->getValue('
SELECT id_zone
FROM '._DB_PREFIX_.'zip_code_zone
WHERE id_country = '.(int)$address->id_country.'
AND min <= '.(int)$address->postcode.' AND max >= '.(int)$address->postcode);
return $zone ? (int)$zone : (int)parent::getZoneById((int)$id_address);
}
}