Jump to content

Error when adding new address in checkout


serphmx

Recommended Posts

Hello everyone,

Looking for help here since I have tried many things and I am out of options. Let me explain the situation:

While creating a new order and trying to add or select an address in the checkout process, the store displays the "Trying to get property of non-object prestashop" error mesage as the first attached image shows.

After looking the code in CustomerAddressForm.php I noticed that somehow the country id is not being processed correctly. The workaround that works for me right now:

 

public function fillWith(array $params = [])

{

// This form is very tricky: fields may change depending on which

// country is being submitted!

// So we first update the format if a new id_country was set.

//if (isset($params['id_country']) && $params['id_country'] != $this->formatter->getCountry()->id)

//---Workaround to get the correct value of the country, removing id

if (isset($params['id_country']) && $params['id_country'] != $this->formatter->getCountry())

{

$this->formatter->setCountry(new Country(

$params['id_country'],

$this->language->id

));

}

return parent::fillWith($params);

}


Using the fix above helps me to complete my order. I believe that maybe the id_country is not being set correctly in the backoffice, maybe in the Localisation or Languages section. I have changed some values in there but no success so far.

So if any of you have encountered this problem or do you have any suggestion to fix this would be appreciated.

Thanks!

Captura de Pantalla 2019-10-15 a la(s) 12.08.20.png

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