i am getting this error when i am trying to save my adress in Prestashop 1.7, i’ve changed adress format in backend and after removing country from format i am unable to save address, can someone please help me with that ?
Image showing that error:
[PrestaShopException] Property Address->id_country is empty at line 915 in file classes/ObjectModel.php 910. } 911. 912. $message = $this->validateField($field, $this->$field); 913. if ($message !== true) { 914. if ($die) { 915. throw new PrestaShopException($message); 916. } 917. return $error_return ? $message : false; 918. } 919. } 920. ObjectModelCore->validateFields - [line 248 - classes/ObjectModel.php] ObjectModelCore->getFields - [line 489 - classes/ObjectModel.php] ObjectModelCore->add - [line 176 - classes/Address.php] - [2 Arguments] AddressCore->add - [line 447 - classes/ObjectModel.php] - [2 Arguments] ObjectModelCore->save - [line 76 - classes/form/CustomerAddressPersister.php] CustomerAddressPersisterCore->save - [line 144 - classes/form/CustomerAddressForm.php] - [2 Arguments] CustomerAddressFormCore->submit - [line 111 - classes/checkout/CheckoutAddressesStep.php] CheckoutAddressesStepCore->handleRequest - [line 57 - classes/checkout/CheckoutProcess.php] - [1 Arguments] CheckoutProcessCore->handleRequest - [line 199 - controllers/front/OrderController.php] - [1 Arguments] OrderControllerCore->initContent - [line 201 - classes/controller/Controller.php] ControllerCore->run - [line 366 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php]
Answer
The country field in the address table of PrestaShop is required, hence it is not possible to remove it from the address format.
Please check the structure of ps_address table in your store’s database for more details.