• Closed by: Marek
  • Closed on: 17.11.17, 15:17
  • Reason: Closed
  • Comment: Glad to help!

Ticket #10710 - Venedor - new registration has "states" field, even if localization / country it is disabled

Sorry that Frontend image is in Finnish, but “Osavaltio” = “State”. The new customer registration seems to forcrfully add it to registration form page, despite that it is disabled in country localization.

Comments

Marek 29 Aug 2017, 10:51

Hi, Marko.
Your website is closed for me. Please allow me access to your back office to be able to disable maintenance mode for me, or just add my IP to exceptions 87.239.222.109

Marko Koskinen 29 Aug 2017, 22:31

Added

Marko Koskinen 29 Aug 2017, 22:37

Also relating to little same, I think I noticed issue that when Advanced parameters / Performance
“Move Java script to the end” is enabled, then registration page has “Postalcode” available, but when
I disable that, then registration is completely missing “Postalcode”, which basically prevents
anyone to register, as registration will complaint about invalid “postalcode” all the time.

Marek 30 Aug 2017, 00:04

I’ll back to you tomorrow, today is too late

Marek 30 Aug 2017, 23:29

I have no permissions to update files on your server. Could you please check the issue?

Marko Koskinen 30 Aug 2017, 23:55

SUDO access should be now added to FTP user mentioned. Tested shortly at least with putty login and editing file with SUDO vi.

Marek 31 Aug 2017, 11:10

Still the same:

Command:	STOR authentication.tpl
Response: 	553 Can't open that file: Permission denied
Error:        	Critical file transfer error
Marko Koskinen 31 Aug 2017, 22:02

I guess only root user has write access to /var/www folder, dont want to mess with that. So it is tricky directly to FTP under /var/www (unless giving root access)
But it works as I have give the user I have created for you a “sudo” possibility.

So you can FTP files to users own /home/<username> folder.

Transferred file will of course have wrong credentials <user>:<user-grp>, but that can be now changed by running “chown” under sudo
#sudo chown www-data:www-data <filename>

and after that it can be copied to correct place from users home folder, eg.
#sudo cp -p <filename> /var/www/prestashop/themes/venedor/<filename>

I have tried that, it works, but of course hopefully you dont need to transfer very many files.

Marek 31 Aug 2017, 23:15

Try to open the file

/var/www/prestashop/themes/venedor/authentication.tpl

find and comment sections related to states, like here:
media.promokit.euscreenshotsscreencloudscreenshot20170831_231423.jpg

you need to add “<!–” and “–>” before and after section

<!--
-->
Marko Koskinen 01 Sep 2017, 02:22

I will try, but it should also automatically do this, based on localization / country settings.

I also wonder, if the code is checking correct variables, like here, it checks against “State:name” and “state”, but
available variables to assign in localization / country for states are: “State:name” and “State:id_code”

{elseif $field_name eq “State:name” || $field_name eq ‘state’}

                                              {assign var='stateExist' value=true}
                                              <div class="required id_state select form-group">
                                                      <div class="selector2">
                                                              <label for="id_state" class="i-state f-label">{l s='State'} <sup>*</sup></label>
                                                              <select name="id_state" id="id_state" class="form-control">
                                                                      <option value="">-</option>
                                                              </select>
                                                      </div>
                                              </div>
                                      {/if}

and is the correct place to comment out is, slightly more down in code perhaps

{if $stateExist eq false}

                                      <p class="required id_state select unvisible form-group">
                                              <div class="selector2">
                                                      <label for="id_state" class="i-state f-label">{l s='State'} <sup>*</sup></label>
                                                      <select name="id_state" id="id_state" class="form-control">
                                                              <option value="">-</option>
                                                      </select>
                                              </div>
                                      </p>
Marko Koskinen 01 Sep 2017, 02:56

that seemed to work !

But that does not sound correct way of doing it….I am wondering why the code is adding it even if check is FALSE

{if $stateExist eq false}

that could be only that because it might be needed somewhere else in the code, and because of this it is added.
Is the idea in the code that element is added, but it should be hidden…???

https://v4-alpha.getbootstrap.com/utilities/invisible-content/

Would it then better to just add “invisible” to it in <div class=”….” ?

                                      <p class="required id_state select unvisible form-group">
                                              <div class="selector2 invisible">
                                                      <label for="id_state" class="i-state f-label">{l s='State'} <sup>*</sup></label>
                                                      <select name="id_state" id="id_state" class="form-control">
                                                              <option value="">-</option>
                                                      </select>
                                              </div>
                                      </p>

That seems also work.

But I am not really a web designer, and dont know anything about bootstrap etc….just was looking code, and tried to understand what is tried to do there.
and was guessing from that <p class=”…unvisible…” that perhaps it just wants to add it hidden ???

But is that <p class=”..unvisible…” correct or should that also be “invisible”..? As adding “invisible” in <div class=”…” hide the state selector?

Marko Koskinen 01 Sep 2017, 03:04

I also dont like the adding of “-” in country list

{elseif $field_name eq “Country:name” || $field_name eq “country”}

                                              <div class="required select form-group">
                                                      <div class="selector2">
                                                              <label for="id_country" class="i-country f-label">{l s='Country'} <sup>*</sup></label>
                                                              <select name="id_country" id="id_country" class="form-control">
                                                                      <option value="">-</option>
                                                                      {foreach from=$countries item=v}
                                                                      <option value="{$v.id_country}"{if (isset($smarty.post.id_country) AND $smarty.post.id_country == $v.id_country) OR (!isset($smarty.post.id_country) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name}</option>
                                                                      {/foreach}
                                                              </select>
                                                      </div>
                                              </div>

as when you now try to select “-” it will just give plenty of errors
- id_country required
- postalcode required
- country is not compatible with address→id_country
- country is wrong

So whole idea of adding this “-” in the list as extra to countries that user has picked in localization / country is quite ridiculous !

Marko Koskinen 01 Sep 2017, 03:12

yes, removing that country “-” helped…no more possible to get errors.

Can you confirm if my “<div class=”invisible…” is correct way to do?

Do you know is that “<p class=”unvisible…” an error…should it be also “invisible”, or is that another class definition, difference between p and div ?

Also relating to REGISTRATION page and dropdown selectors, like birthdays and the COUNTRY. The problem is that the opened list of countries is much smaller
than the dropdown selector, this causes that mouse click is not accepted on whole COUNTRY selector area, eg. trying to click on the open “arrow” icon on right side
of COUNTRY dropdown does nothing.

It works better on birthday selecttors, as the opened list items are same size as dropdown selectors.

Marko Koskinen 01 Sep 2017, 03:13

forgot to add pictures of those selectors and opened list sizes

Marek 01 Sep 2017, 17:49

Yes, “invisible” class is correct way as well.
I have read all your messages, but all that is related to the PrestaShop code. Venedor theme is based on default Prestashop theme and most of the files are the same

Marko Koskinen 02 Sep 2017, 21:47

Yes, I noticed the same, as I compared this file in Vendor theme into the one in default theme. That way it is out of your support.
Thanks still about hint to place to look.

Is that “<p class=”unvisible….” correct, I mean is that unvisible typing error, or also unvisible is correct?
even if it seems to work with invisible in “<div class=….”

But that use of invisible, is fine for me, and also removing tat “-” from country list helps a lot to avoid error messages.

Marek 04 Sep 2017, 10:24

There is “unvisible” used in the default prestashop theme.