Jump to content

PS 1.6 Customer address pull down for country not working


Recommended Posts

Hello,

I am running PS 1.6.1.7 and recently discovered that when new customers register their addresses, the country pull down menu is blank. There's nothing to choose from.  Something got corrupted or changed, because it used to work just fine.

In the Localization tab in the back office, all countries are properly activated.

When I go to the configuration page, the only notes I see are listed below. I have no idea if any of these are relevant.

Can anyone help? Any suggestions? THANKS!
 

Missing files (1)

admin3348/filemanager/uploader/success.php

Updated files (5)

admin3348/ajax.php

admin3348/autoupgrade/index.php

admin3348/themes/default/template/controllers/products/helpers/form/form.tpl

controllers/admin/AdminAccessController.php

controllers/front/ContactController.php

Link to comment
Share on other sites

12 hours ago, howardliptzin said:

I disabled modules, cleared the prestashop cache and the browser, logged out, logged back in and still the problem persists.

1) Open the root/controllers/front/addresscontroller.php file.
Search for n assignCountries 
See if it's there.

2) In the path root/override/controllers/front/addresscontroller.php
if there is a file like this, rename it, then clear the cache and check again in private browser mode.

Link to comment
Share on other sites

(1) In root/controllers/front/addresscontroller.php file I found the assignCountries section (pasted in below).

(2) The file addresscontroller.php does NOT exist in the path root/override/controllers/front/addresscontroller.php

Here is the code:

protected function assignCountries()
    {
        $this->id_country = (int)Tools::getCountry($this->_address);
        // Generate countries list
        if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
            $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
        } else {
            $countries = Country::getCountries($this->context->language->id, true);
        }

        // @todo use helper
        $list = '';
        foreach ($countries as $country) {
            $selected = ((int)$country['id_country'] === $this->id_country) ? ' selected="selected"' : '';
            $list .= '<option value="'.(int)$country['id_country'].'"'.$selected.'>'.htmlentities($country['name'], ENT_COMPAT, 'UTF-8').'</option>';
        }

        // Assign vars
        $this->context->smarty->assign(array(
            'countries_list' => $list,
            'countries' => $countries,
            'sl_country' => (int)$this->id_country,
        ));
    }

    /**
     * Assign template vars related to address format
     */

(2) 

Link to comment
Share on other sites

Look the countries are assigned to the $list variable, you should try to print this and check if it contains anything, if not switch the line:

"if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {" to "if (!Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {" (notice the !) and print again - if it contains anything goo then the configuration "PS_RESTRICT_DELIVERED_COUNTRIES" is the problem otherwise it's somewhere else

Link to comment
Share on other sites

Hello, thanks for the info, but I do not fully understand the instructions.

You wrote:

Quote

 

Look the countries are assigned to the $list variable, you should try to print this and check if it contains anything, if not switch the line:

 

I do not understand what you mean by "try to print this". Print the code on paper?

Why do I have to print and not just read the file on the screen?

And then -- what do you mean if it contains ANYTHING? What do you mean by ANYTHING!? Please explain this again in other words or with more detail. 

THANKS!

 

Link to comment
Share on other sites

Hey it worked!! THANKS FOR YOUR HELP.

😃

But now I notice a few more things wrong. (I don't know what happened to "break" the site...)

(1) The "State" pull down has the same problem.

(2) I do not see any Zip Code field.

(3) Whenever I login as a customer on the front end, when I click on the add address link the page refreshes to an address form without full header or footer of the site. When i click to go back to the home I just see blank white page with just the logo. When I clear the browser's cache, the site is back again, but if I login again and try insert an address the same thing happens over and over again.

It would be great if you or someone out there could help me again.

-H

Link to comment
Share on other sites

The code change was to check what might be the problem - not to remain like that, you need to change the code back to how it was, but basically you know that  "PS_RESTRICT_DELIVERED_COUNTRIES" is the issue so you need to find in the back office where the setting for restricted countries is and enable available countries from there.

Link to comment
Share on other sites

Probably same cause - look into your settings where you find some kind of *country restrictions / enabled countries* and check if all is ok there - most likely in regionalization and / or shop settings (btw it doesn't mean that the settings are incorrect also, it might also be a Prestashop issue but in that case it is much harder to investigate and or resolve)

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...