Jump to content

Edit/change/hide/remove form control comments.


Recommended Posts

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?

remove.png

Edited by zunxunz (see edit history)
Link to comment
Share on other sites

1 hour ago, ComGrafPL said:

Have you tried here?

 

screenshot-ps1771.p11_44_30.png

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 by zunxunz
typo / addition (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...