rseigel Posted July 31, 2015 Share Posted July 31, 2015 Hi all, I'm using my EAN13 field to insert the Amazon ASIN number instead. I accomplished this by changing line 279 in classes/Product.php from: 'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isean13', 'size' => 13), to: 'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 10), So far so good. Now I also need to be able to reuse the EAN13 field in COmbinations for the same purpose (in this case sizes). I can't seem to locate the file (I can't find another instance of validation in Product.php so I have to assume it's in another file) that contains the validation for the EAN13 field in combinations. Does anyone know where I should look? Thanks, Ron Link to comment Share on other sites More sharing options...
rseigel Posted July 31, 2015 Author Share Posted July 31, 2015 BTW....I've already tried changing it in classes/Combination.php with no luck. It still gives the error: Field ean13 is not valid Link to comment Share on other sites More sharing options...
Paul C Posted July 31, 2015 Share Posted July 31, 2015 (edited) Not that I can recommend what you're doing - you should really look at adding an additional field... but....... Wouldn't it just have been much simpler (and less destructive of the core files) just to add an override for the validation? Just stick this in a file called: /override/classes/Validate.php and stop editing those core files <?php class Validate extends ValidateCore { /* * Pretend that we're really checking an ean * but treat a string as valid * */ public static function isEan13($ean13) { return is_string($ean13); } } Edited July 31, 2015 by Paul C (see edit history) Link to comment Share on other sites More sharing options...
rseigel Posted July 31, 2015 Author Share Posted July 31, 2015 Thanks very much for the help. You're absolutely correct about not touching core files. I knew better - was just looking for a shortcut. For some reason your code still doesn't work for combinations. Still getting "Field ean13 is not valid". There has to be another check somewhere for the EAN13 field in the combinations. Link to comment Share on other sites More sharing options...
rseigel Posted July 31, 2015 Author Share Posted July 31, 2015 Ooops....forgot to delete cache/class_index.php Works perfect now. Thanks. 1 Link to comment Share on other sites More sharing options...
Paul C Posted July 31, 2015 Share Posted July 31, 2015 (edited) Did you remember to delete /cache/class_index.php? The override probably won't take effect until you do. EDIT: You beat me to it. Edited July 31, 2015 by Paul C (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now