pool guevara Posted April 29, 2016 Share Posted April 29, 2016 Como validar formato de nombres apellidos a un mínimo de 2 caracteres tanto para registro como para compra de cliente igual necesito hacerlo para el numero telefonico tengo prestashop 1.6.0.9 Link to comment Share on other sites More sharing options...
Rolige Posted April 29, 2016 Share Posted April 29, 2016 Debes modificar la clase de Validate y la de Customer En la clase Validate: /classes/Validate.php Añade un nuevo metodo: /** * Check for name validity minimum 2 chars * * @param string $name Name to validate * @return boolean Validity is ok or not */ public static function isNameCustom($name) { return preg_match(Tools::cleanNonUnicodeSupport('/^[^0-9!<>,;?=+()@#"°{}_$%:]{2,}$/u'), stripslashes($name)); } Ahora en la clase Customer: /classes/Customer.php Donde dice: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), Cambialos por: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isNameCustom', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isNameCustom', 'required' => true, 'size' => 32), Y listo. Link to comment Share on other sites More sharing options...
pool guevara Posted April 29, 2016 Author Share Posted April 29, 2016 (edited) listo eso ya esta corregido el error 500 un favor ahora con lo del telefono Edited April 29, 2016 by pool guevara (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts