php - Custom field validation when registering. Prestashop -


i have problem when validating customer registration form. it's not working @ all. want validate custom field added reg form. write steps i've done , please tell me problem.

  1. i've added custom field in registration form. placed in /themes/theme/authentication.tpl

    <div class="required form-group">         <label for="user_id_number">id <sup>*</sup></label>          <input type="text"  onkeyup="$('#user_id_number').val(this.value);"          class="is_required validate account_input form-control"  id="user_id_number" name="user_id_number"          value="{if isset($smarty.post.user_id_number)}{$smarty.post.user_id_number}{/if}" />     </div> 
  2. overridden address.php (addrescore class) , added field name $definition array.

     class address extends addresscore {           public $user_id_number;          public static $definition = array(    'table' => 'address',   'primary' => 'id_address',   'fields' => array(   'id_customer' =>        array('type' => self::type_int, 'validate' => 'isnullorunsignedid', 'copy_post' => false),     'id_manufacturer' =>    array('type' => self::type_int, 'validate' => 'isnullorunsignedid', 'copy_post' => false),     'id_supplier' =>        array('type' => self::type_int, 'validate' => 'isnullorunsignedid', 'copy_post' => false),     'id_warehouse' =>        array('type' => self::type_int, 'validate' => 'isnullorunsignedid', 'copy_post' => false),     'id_country' =>        array('type' => self::type_int, 'validate' => 'isunsignedid', 'required' => true),     'id_state' =>            array('type' => self::type_int, 'validate' => 'isnullorunsignedid'),     'alias' =>                array('type' => self::type_string, 'validate' => 'isgenericname', 'required' => true, 'size' => 32),     'company' =>            array('type' => self::type_string, 'validate' => 'isgenericname', 'size' => 64),     'lastname' =>            array('type' => self::type_string, 'validate' => 'isname', 'required' => true, 'size' => 32),     'firstname' =>            array('type' => self::type_string, 'validate' => 'isname', 'required' => true, 'size' => 32),     'vat_number' =>            array('type' => self::type_string, 'validate' => 'isgenericname'),     'address1' =>            array('type' => self::type_string, 'validate' => 'isaddress', 'required' => true, 'size' => 128),     'address2' =>            array('type' => self::type_string, 'validate' => 'isaddress', 'size' => 128),     'postcode' =>            array('type' => self::type_string, 'validate' => 'ispostcode', 'size' => 12),     'city' =>                array('type' => self::type_string, 'validate' => 'iscityname', 'required' => true, 'size' => 64),     'other' =>                array('type' => self::type_string, 'validate' => 'ismessage', 'size' => 300),     'phone' =>                array('type' => self::type_string, 'validate' => 'isphonenumber', 'size' => 32),     'phone_mobile' =>        array('type' => self::type_string, 'validate' => 'isphonenumber', 'size' => 32),     'dni' =>                array('type' => self::type_string, 'validate' => 'isdnilite', 'size' => 16),     'deleted' =>            array('type' => self::type_bool, 'validate' => 'isbool', 'copy_post' => false),     'date_add' =>            array('type' => self::type_date, 'validate' => 'isdate', 'copy_post' => false),     'date_upd' =>            array('type' => self::type_date, 'validate' => 'isdate', 'copy_post' => false),      'user_id_number' =>     array('type' => self::type_string, 'validate' => 'isvalididnumber', 'required' => true), //my custom field ), );   public function __construct(){    // var_dump($user_id_number);  }   } 
  3. overridden validation.php (validationcore class) , added validation function.

      class validate extends validatecore {       public static function isvalididnumber($user_id_number){     var_dump($user_id_number);       if( strlen($user_id_number) != 11){         return false;     }     return false;    }  } 
  4. added custom field variable authcontroller.php image 1 image 2

  5. added new field ps_customer database table.

what i've missed?


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -