zunxunz Posted January 30 Share Posted January 30 (edited) We want to change the form control comments in the checkout form, but it's unclear where they are defined. How would we edit/change/add form control comments? Are there hooks available that could allow us to modify the form fields programmatically from within a custom module? Edited January 30 by zunxunz (see edit history) Link to comment Share on other sites More sharing options...
ComGrafPL Posted January 30 Share Posted January 30 Have you tried here? Link to comment Share on other sites More sharing options...
zunxunz Posted January 30 Author Share Posted January 30 (edited) 1 hour ago, ComGrafPL said: Have you tried here? Thank you, but that is not what I mean. We do not just want to change a translations of the comments, but we want to be able to add/change the actual form fields without having to touch core code. But since the form fields are currently being defined (hard coded) in the class CustomerFormatter, apparently it's not possible. So... I seem to kind of have answered my own question here... the form field definition is hard coded in that class and the method getFormat() has no 'hook' to amend those fields except for adding an 'override' for that class in a module, which is being discouraged by Prestashop, sigh. That is not the correct way to define a form and/or it's fields, hard coded in a PHP class. The form fields should be defined in a mendable xml or json file, or in a template if anything, but -definitely not- -hard coded- in a class, that is really and seriously very bad coding practice. This is becoming increasingly frustrating with newer versions of Prestashop since 1.7. Fewer and fewer options to customize, while at the same time lots of layers of unmendable complexity are being added to the core code and the basic theme ... very annoying. Edited January 30 by zunxunz typo / addition (see edit history) Link to comment Share on other sites More sharing options...
zunxunz Posted January 30 Author Share Posted January 30 As it turns out, the hook called 'additionalCustomerFormFields', does in fact allow us to change the form fields, even though the name of the hook hints that this hook is intended to 'add' fields, which is what 'additional' means. Can we at least have hooks that have names that actually hint to what they are intended for? Yes, I sound a little sour here, sorry, unfortunately that's the effect that PS coding currently has on me... 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