Jump to content

[Solved] Fatal Error - Add An Address


Recommended Posts

I have a shop currently at 1.4.6.2 that has been upgraded many times since the original install running 1.3. I noticed a problem when an existing user tries to add an address. This may not be a 1.4.6.2 problem as it may have been there previously, but just noticed. Here are the symptoms.

 

1. User who is logged in FO selects "My Addresses" in the "My Account" block.

2. User is able to update and save an existing address with no problem.

3. User attempts to add a new address - the form opens but there is no field for state or country displayed.

4. If user enters data and clicks save, a white screen and "Fatal Error" is displayed.

5. I have an override for AddressController.php that I removed for testing - same problem without the override

 

Things I've looked at:

1. When a user creates an account, the state and country fields are displayed and the data is saved properly

2. When adding an address in the BO, all the proper fields are displayed and the records saves properly

3. Enabling "Debug" in config.inc.php didn't display anything when the fatal error is displayed

4. I have a custom theme, but to test this, using the stock Prestashop theme has the same fatal error.

 

How can I debug this to find the source of the problem?

 

Updated 30 Dec 2011 - Problem solved. Somehow the ps_address_format table was corrupted. I was able to drop the corrupted table and used one to replace it from a clean 1.4.6.2 install. All works fine again.

Link to comment
Share on other sites

That was a fast reply! Here is what I get when adding an address:

 

Array
(
   [0] => Array
    (
	    [file] => /home/chnycus/public_html/shop/override/controllers/AddressController.php
	    [line] => 70
	    [function] => displayError
	    [class] => ToolsCore
	    [type] => ::
	    [args] => Array
		    (
		    )
    )
   [1] => Array
    (
	    [file] => /home/chnycus/public_html/shop/classes/FrontController.php
	    [line] => 63
	    [function] => preProcess
	    [class] => AddressController
	    [object] => AddressController Object
		    (
			    [auth] => 1
			    [guestAllowed] => 1
			    [php_self] => address.php
			    [authRedirection] => addresses.php
			    [ssl] => 1
			    [_address:protected] =>
			    [errors] => Array
				    (
					    [0] => country ID is required.
				    )
			    [iso] =>
			    [orderBy] =>
			    [orderWay] =>
			    [p] =>
			    [n] =>
			    [restrictedCountry:protected] =>
			    [maintenance:protected] =>
		    )
	    [type] => ->
	    [args] => Array
		    (
		    )
    )
   [2] => Array
    (
	    [file] => /home/chnycus/public_html/shop/address.php
	    [line] => 29
	    [function] => run
	    [class] => FrontControllerCore
	    [object] => AddressController Object
		    (
			    [auth] => 1
			    [guestAllowed] => 1
			    [php_self] => address.php
			    [authRedirection] => addresses.php
			    [ssl] => 1
			    [_address:protected] =>
			    [errors] => Array
				    (
					    [0] => country ID is required.
				    )
			    [iso] =>
			    [orderBy] =>
			    [orderWay] =>
			    [p] =>
			    [n] =>
			    [restrictedCountry:protected] =>
			    [maintenance:protected] =>
		    )
	    [type] => ->
	    [args] => Array
		    (
		    )
    )
)

Link to comment
Share on other sites

I've removed the addresscontroller override and get this error dump:

 

Array
(
   [0] => Array
    (
	    [file] => /home/chnycus/public_html/shop/controllers/AddressController.php
	    [line] => 93
	    [function] => displayError
	    [class] => ToolsCore
	    [type] => ::
	    [args] => Array
		    (
		    )
    )
   [1] => Array
    (
	    [file] => /home/chnycus/public_html/shop/classes/FrontController.php
	    [line] => 63
	    [function] => preProcess
	    [class] => AddressControllerCore
	    [object] => AddressController Object
		    (
			    [auth] => 1
			    [guestAllowed] => 1
			    [php_self] => address.php
			    [authRedirection] => addresses.php
			    [ssl] => 1
			    [_address:protected] =>
			    [errors] => Array
				    (
					    [0] => country ID is required.
				    )
			    [iso] =>
			    [orderBy] =>
			    [orderWay] =>
			    [p] =>
			    [n] =>
			    [restrictedCountry:protected] =>
			    [maintenance:protected] =>
		    )
	    [type] => ->
	    [args] => Array
		    (
		    )
    )
   [2] => Array
    (
	    [file] => /home/chnycus/public_html/shop/address.php
	    [line] => 29
	    [function] => run
	    [class] => FrontControllerCore
	    [object] => AddressController Object
		    (
			    [auth] => 1
			    [guestAllowed] => 1
			    [php_self] => address.php
			    [authRedirection] => addresses.php
			    [ssl] => 1
			    [_address:protected] =>
			    [errors] => Array
				    (
					    [0] => country ID is required.
				    )
			    [iso] =>
			    [orderBy] =>
			    [orderWay] =>
			    [p] =>
			    [n] =>
			    [restrictedCountry:protected] =>
			    [maintenance:protected] =>
		    )
	    [type] => ->
	    [args] => Array
		    (
		    )
    )
)

Link to comment
Share on other sites

I don't understand why the country id isn't being sent. If I remove the override and use the stock Prestashop template, it is a normal configuration. Notice item #3 in my summary:

 

3. User attempts to add a new address - the form opens but there is no field for state or country displayed.

 

How can I debug that to see why the field for country and state are not displayed? I think that's the path to solve this.

Link to comment
Share on other sites

This is what I have for the US address definition (includes both states and Country):

 

firstname lastname

company

address1 address2

city, State:name postcode Country:name

phone

phone_mobile

 

I am able to edit existing addresses, and the invoices print properly

Link to comment
Share on other sites

  • 2 weeks later...

Problem solved - the following was added to the original post

 

Updated 30 Dec 2011 - Problem solved. Somehow the ps_address_format table was corrupted. I was able to drop the corrupted table and used one to replace it from a clean 1.4.6.2 install. All works fine again.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

Hi

We are currently having the same problem with no country showing on the drop down menu on the account set up page. We have tried various things as suggested above and have been advised it may be a corrupted table. Please can you advise how we can locate the corrupted table and how we replace it.

thanks

rachel

Link to comment
Share on other sites

  • 4 months later...

This solved this issue for me - http://www.prestashop.com/forums/topic/174926-creating-a-new-account-address-country-drop-down-is-empty-causing-error-message/

 

Hi rachel,

In your Back Office, please go to Shipping > Countries and select the UK. There, please check if Country:name is listed under "Address Format." If not, that is likely the cause of your error.

 

post-276528-0-75956000-1340303617_thumb.png

 

I hope this helps.

 

-Mike

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

  • 1 year later...

Problem solved - the following was added to the original post

 

Updated 30 Dec 2011 - Problem solved. Somehow the ps_address_format table was corrupted. I was able to drop the corrupted table and used one to replace it from a clean 1.4.6.2 install. All works fine again.

 

 

I have exactly the same problem with the ps_address_format after upgrading from version 1.4 to 1.6 !!!! Corrupted data !!!

Thank you !!!

Link to comment
Share on other sites

  • 7 months later...

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