BobPour Posted July 21, 2011 Share Posted July 21, 2011 I am pretty sure this is super simple…We only sell to stores and we keep track of our customers by customer code (combination of letters and numbers)I am importing our customer list into PS (using CSV) and using "Name field" for customer code (something like XYZ01) I get error massage in process of importing because I am using the numerical character in name field. Is there a simple way around that?I was thinking of changing the “ps_customer” structure to allow numbers.I am not sure what I have to change the “firstname” Type or Collation to; in order to allow storing numbers and letters combination that field. Link to comment Share on other sites More sharing options...
shokinro Posted July 21, 2011 Share Posted July 21, 2011 I think you will have to change class Cuatomer in file /classes/Customer.phpThere is a validation type definition of fields array, so you need to do is change it to something else. protected $fieldsValidate = array('secure_key' => 'isMd5', 'lastname' => 'isName', 'firstname' => 'isName', 'email' => 'isEmail', 'passwd' => 'isPasswd', 'id_gender' => 'isUnsignedId', 'birthday' => 'isBirthDate', 'newsletter' => 'isBool', 'optin' => 'isBool', 'active' => 'isBool', 'note' => 'isCleanHtml', 'is_guest' => 'isBool'); you can just remove it from list to avoid validation Link to comment Share on other sites More sharing options...
BobPour Posted July 21, 2011 Author Share Posted July 21, 2011 Thanks for response.You directed me into a correct direction (I assumed it get validated in sql) anyhow, I end up change it to:“isGenericName” and now it works.There is another validation in Address.PHP (inside class folder) that needs to be changed as wellSo conclusion is per default PS installation it is not possible to have 50 cents as a customer :-) Link to comment Share on other sites More sharing options...
BobPour Posted July 21, 2011 Author Share Posted July 21, 2011 I found a better solution!Under class folder file Validate.php, change: /** * Check for name validity * * @param string $name Name to validate * @return boolean Validity is ok or not */ static public function isName($name) { return preg_match('/^[^0-9!<>,;?=+()@#"°{}_$%:]*$/u', stripslashes($name)); } To: /** * Check for name validity * * @param string $name Name to validate * @return boolean Validity is ok or not */ static public function isName($name) { return preg_match('/^[^!<>,;?=+()@#"°{}_$%:]*$/u', stripslashes($name)); } Now I don’t have to look for “isName” in all my files and changed them manually Link to comment Share on other sites More sharing options...
shokinro Posted July 21, 2011 Share Posted July 21, 2011 yes this is another way to do that.but don't forget it wil affect all other places. any places use this validation will be affected. If it is ok with you, then it is a better solution. Link to comment Share on other sites More sharing options...
BobPour Posted July 21, 2011 Author Share Posted July 21, 2011 hmmm, Actually I am not sure what are the places that using isName so I think it is smarter to not to modify it.Thanks for heads up and I go with first solution. Link to comment Share on other sites More sharing options...
Recommended Posts