sebasca5 Posted August 14, 2015 Share Posted August 14, 2015 (edited) Recientemente al intentar crear un nuevo país me arrojaba el siguiente error Invalid address layout Duplicate entry Esto se presenta ya que cuando eliminas un país previamente, Prestashop no borra el registro en la tabla ps_address_format Para solucionarlo solo debes seguir estos pasos: 1) En la clase country.php ubicate en la funcion public function delete() public function delete() { if (!parent::delete()) return false; return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_country WHERE id_country = '.(int)$this->id); } 2) luego remplaza esa funcion por esta: public function delete() { Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'address_format WHERE id_country not in (SELECT id_country FROM '._DB_PREFIX_.'country)'); Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'address_format WHERE id_country = '.(int)$this->id); if (!parent::delete()) return false; Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'address_format WHERE id_country = '.(int)$this->id); return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_country WHERE id_country = '.(int)$this->id); } Esta se encargará de eliminar el formato de dirección de la tabla ps_address_format cada que elimines un pais Edited August 14, 2015 by sebasca5 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts