Presta 8 - How to control what form fields are displaying in forms on checkout pages

59 Views Asked by At

On checkout steps - first step "personal-information.tpl" has a forms for login or creating account.

I need to modify fields of this form - modify form actually. There is a gender radio input that I do not want to be seen for ex. or birthday date field.

So I have created folder form in override/classes and put there CustomerFormatter.php class -to override form class (as I do not want to modify Presta core files)

I thought that:

private $ask_for_birthdate = true;
private $ask_for_partner_optin = true;
private $partner_optin_is_required = true;

stands for form fields to be shown or not - but it seems that was wrong.. (have set $ask_for_birthday to false but the birthday date field is still present in form)

What am I missing? How to control what form fields are displaying in forms on checkout pages?

UPDATE I have found that birthday date in forms can be turn off in PS options. But when I make changes in override the gender fields they are still there.

When I make change in classes/form/CustomerFormatter.php - it behaves as it should but when in:

override/classes/form/CustomerFormatter.php - nothing happens....

I work on PS 8.04

1

There are 1 best solutions below

0
ButcherFromHell On

I found the problem and will share solution.

1 -override class must extend core - which I was missing - that was reason why changes made in class did nothing.

so override/classes/form/CustomerFormatter.php should start with

class CustomerFormatter extends CustomerFormatterCore

rookie mistake..

2 - as pointed by @ébewè You can disable Genders from the BO, by:

  • going to Shop parameters > Customers - selecting Genders tab - removing all the genders By doing so, the genders will disappear from the form.
  • Shop parameters > Customers -> Customers tab, you can enable/disable the birth date and the partner offers fields