argamanza Posted January 4, 2013 Share Posted January 4, 2013 Hello, I'm trying to allow More characters in the product Name and Reference fields when i'm adding \ editing a product, I've searched in the informations.tpl file (admin\themes\default\template\controllers\products\informations.tpl) and in classess\Product.php which looked like the files i'll find it in, and i just can't find anything, Can someone give me a hint about Where i define which character is allowed and which is forbidden? (If you ask i need to add characters that normally found in a URL, Like = & + etc.) Thank you! Link to comment Share on other sites More sharing options...
ReactionCode Posted January 4, 2013 Share Posted January 4, 2013 Hi for this you have to override the validate.php class on the override folder class Validate extends ValidateCore { /** * Check for product or category name validity * * @param string $name Product or category name to validate * @return boolean Validity is ok or not */ public static function isCatalogName($name) { return preg_match('/^[^<>;=#{}]*$/u', $name); //This function del this characters on your name var. } } Tell me if it's ok 2 Link to comment Share on other sites More sharing options...
argamanza Posted January 5, 2013 Author Share Posted January 5, 2013 Thanks a lot! I edited Classes/Validate.php and searched for "IsReference" Then just remove any special char you want to allow. Thanks again you helped me a lot! Link to comment Share on other sites More sharing options...
smariel Posted January 15, 2013 Share Posted January 15, 2013 I had the same problem, and did the same. The question is : are there any good reason why those characters were forbidden at some point or is this jus an arbitrary convention?? If yes removing this validation removal could have some pretty weird effects... Even though according to me all names & fields should/are escaped (so basically there should be no problem whith =;<> )... Does anybody has an idea about that point ? These default could be related to import, filtering... Stéphane. 1 Link to comment Share on other sites More sharing options...
silvioscavone Posted April 26, 2017 Share Posted April 26, 2017 Hello, I have a CSV to import, but a lot of products have special characters in product name, reference, meta title and meta description. I changed: public static function isCatalogName($name) { // return preg_match('/^[^<>;=#{}]*$/u', $name); return preg_match('/^$/u', $name); } and public static function isReference($reference) { // return preg_match('/^[^<>;={}]*$/u', $reference); return preg_match('/^$/u', $reference); } I succeded to import the products with "#" character but I still can't import products with ">" and "=" characters Any idea? Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts