Outils pour utilisateurs

Outils du site


Panneau latéral

webdev:prestashop:error_handling_front

Error handling on front

Controller side :

		// Check
		if( !Validate::isPhoneNumber( $_POST['phone'] ) )
		{
			$this->errors[] = Tools::displayError('Invalid phone number');
		}
		if( !Validate::isEmail( $_POST['email'] ) )
		{
			$this->errors[] = Tools::displayError('Invalid email');
		}

		if(!empty($this->errors))
		{
			return false;
		}

Template side : make sure your have

{include file="$tpl_dir./errors.tpl"}

Involved classes : .alert, .alert-success, .alert-danger, .alert-error

webdev/prestashop/error_handling_front.txt · Dernière modification: 29/06/2017 16:36 de dolo