Jump to content

Numero de caracteres para registro de clientes


Recommended Posts

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

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...