Jump to content

Server error 500 prestashop 1.7 en la tramitación de un pedido


Recommended Posts

Buenas, me sale un error 500 cuando intento realizar una compra en mi tienda. Esto ocurre cuando meto los datos de contacto y pulso en continuar al siguiente paso.

 

He probado ya a utilizar la plantilla por defecto, a actualizar a prestashop 1.7.1.1 y el error persiste. Estoy desesperado y ya no se que hacer.

 

El error en modo depuración es este:

 

[PrestaShopException]

Property Address->dni 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]
    243. * @return array All object fields
    244. * @throws PrestaShopException
    245. */
    246. public function getFields()
    247. {
    248. $this->validateFields();
    249. $fields = $this->formatFields(self::FORMAT_COMMON);
    250.
    251. // For retro compatibility
    252. if (Shop::isTableAssociated($this->def['table'])) {
    253. $fields = array_merge($fields, $this->getFieldsShop());
  • ObjectModelCore->getFields - [line 489 - classes/ObjectModel.php]
    484.
    485. // Database insertion
    486. if (Shop::checkIdShopDefault($this->def['table'])) {
    487. $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
    488. }
    489. if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values)) {
    490. return false;
    491. }
    492.
    493. // Get object id in database
    494. $this->id = Db::getInstance()->Insert_ID();
  • ObjectModelCore->add - [line 176 - classes/Address.php] - [2 Arguments]
    171. /**
    172. * @see ObjectModel::add()
    173. */
    174. public function add($autodate = true, $null_values = false)
    175. {
    176. if (!parent::add($autodate, $null_values)) {
    177. return false;
    178. }
    179.
    180. if (Validate::isUnsignedId($this->id_customer)) {
    181. Customer::resetAddressCache($this->id_customer, $this->id);
  • AddressCore->add - [line 447 - classes/ObjectModel.php] - [2 Arguments]
    442. * @return bool Insertion result
    443. * @throws PrestaShopException
    444. */
    445. public function save($null_values = false, $auto_date = true)
    446. {
    447. return (int)$this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);
    448. }
    449.
    450. /**
    451. * Adds current object to the database
    452. *
  • ObjectModelCore->save - [line 73 - classes/form/CustomerAddressPersister.php]
    68.
    69. if ($address->isUsed()) {
    70. $old_address = new Address($address->id);
    71. $address->id = $address->id_address = null;
    72.
    73. return $address->save() && $old_address->delete();
    74. }
    75.
    76. return $address->save();
    77. }
    78.
  • CustomerAddressPersisterCore->save - [line 145 - classes/form/CustomerAddressForm.php] - [2 Arguments]
    140. $this->address = $address;
    141.
    142. return $this->persister->save(
    143. $this->address,
    144. $this->getValue('token')
    145. );
    146. }
    147.
    148. public function getAddress()
    149. {
    150. return $this->address;
  • CustomerAddressFormCore->submit - [line 111 - classes/checkout/CheckoutAddressesStep.php]
    106. 'firstname' => $this->getCheckoutSession()->getCustomer()->firstname,
    107. 'lastname' => $this->getCheckoutSession()->getCustomer()->lastname,
    108. ));
    109.
    110. if (isset($requestParams['saveAddress'])) {
    111. $saved = $this->addressForm->fillWith($requestParams)->submit();
    112. if (!$saved) {
    113. $this->step_is_current = true;
    114. $this->getCheckoutProcess()->setHasErrors(true);
    115. if ($requestParams['saveAddress'] === 'delivery') {
    116. $this->show_delivery_address_form = true;
  • CheckoutAddressesStepCore->handleRequest - [line 57 - classes/checkout/CheckoutProcess.php] - [1 Arguments]
    52. }
    53.
    54. public function handleRequest(array $requestParameters = array())
    55. {
    56. foreach ($this->getSteps() as $step) {
    57. $step->handleRequest($requestParameters);
    58. }
    59.
    60. return $this;
    61. }
    62.
  • CheckoutProcessCore->handleRequest - [line 200 - controllers/front/OrderController.php] - [1 Arguments]
    195. parent::initContent();
    196.
    197. $this->restorePersistedData($this->checkoutProcess);
    198. $this->checkoutProcess->handleRequest(
    199. Tools::getAllValues()
    200. );
    201.
    202. $presentedCart = $this->cart_presenter->present($this->context->cart);
    203.
    204. if (count($presentedCart['products']) <= 0 || $presentedCart['minimalPurchaseRequired']) {
    205. Tools::redirect('index.php?controller=cart');
  • OrderControllerCore->initContent - [line 201 - classes/controller/Controller.php]
    196. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    197. $this->initHeader();
    198. }
    199.
    200. if ($this->viewAccess()) {
    201. $this->initContent();
    202. } else {
    203. $this->errors[] = Tools::displayError('Access denied.');
    204. }
    205.
    206. if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
  • ControllerCore->run - [line 366 - classes/Dispatcher.php]
    361. if (isset($params_hook_action_dispatcher)) {
    362. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    363. }
    364.
    365. // Running controller
    366. $controller->run();
    367. } catch (PrestaShopException $e) {
    368. $e->displayMessage();
    369. }
    370. }
    371.
  • DispatcherCore->dispatch - [line 28 - index.php]
    23. * @license http://opensource.or...ses/osl-3.0.php Open Software License (OSL 3.0)
    24. * International Registered Trademark & Property of PrestaShop SA
    25. */
    26.
    27. require(dirname(__FILE__).'/config/config.inc.php');
    28. Dispatcher::getInstance()->dispatch();
 
 
 
No tengo campo obligatorio para el DNI...
 
Alguna idea????
Link to comment
Share on other sites

  • 8 months later...
On 5/17/2017 at 9:52 AM, ales699 said:

Buenas, me sale un error 500 cuando intento realizar una compra en mi tienda. Esto ocurre cuando meto los datos de contacto y pulso en continuar al siguiente paso.

 

He probado ya a utilizar la plantilla por defecto, a actualizar a prestashop 1.7.1.1 y el error persiste. Estoy desesperado y ya no se que hacer.

 

El error en modo depuración es este:

 

[PrestaShopException]

Property Address->dni 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]
    243. * @return array All object fields
    244. * @throws PrestaShopException
    245. */
    246. public function getFields()
    247. {
    248. $this->validateFields();
    249. $fields = $this->formatFields(self::FORMAT_COMMON);
    250.
    251. // For retro compatibility
    252. if (Shop::isTableAssociated($this->def['table'])) {
    253. $fields = array_merge($fields, $this->getFieldsShop());
  • ObjectModelCore->getFields - [line 489 - classes/ObjectModel.php]
    484.
    485. // Database insertion
    486. if (Shop::checkIdShopDefault($this->def['table'])) {
    487. $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
    488. }
    489. if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values)) {
    490. return false;
    491. }
    492.
    493. // Get object id in database
    494. $this->id = Db::getInstance()->Insert_ID();
  • ObjectModelCore->add - [line 176 - classes/Address.php] - [2 Arguments]
    171. /**
    172. * @see ObjectModel::add()
    173. */
    174. public function add($autodate = true, $null_values = false)
    175. {
    176. if (!parent::add($autodate, $null_values)) {
    177. return false;
    178. }
    179.
    180. if (Validate::isUnsignedId($this->id_customer)) {
    181. Customer::resetAddressCache($this->id_customer, $this->id);
  • AddressCore->add - [line 447 - classes/ObjectModel.php] - [2 Arguments]
    442. * @return bool Insertion result
    443. * @throws PrestaShopException
    444. */
    445. public function save($null_values = false, $auto_date = true)
    446. {
    447. return (int)$this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);
    448. }
    449.
    450. /**
    451. * Adds current object to the database
    452. *
  • ObjectModelCore->save - [line 73 - classes/form/CustomerAddressPersister.php]
    68.
    69. if ($address->isUsed()) {
    70. $old_address = new Address($address->id);
    71. $address->id = $address->id_address = null;
    72.
    73. return $address->save() && $old_address->delete();
    74. }
    75.
    76. return $address->save();
    77. }
    78.
  • CustomerAddressPersisterCore->save - [line 145 - classes/form/CustomerAddressForm.php] - [2 Arguments]
    140. $this->address = $address;
    141.
    142. return $this->persister->save(
    143. $this->address,
    144. $this->getValue('token')
    145. );
    146. }
    147.
    148. public function getAddress()
    149. {
    150. return $this->address;
  • CustomerAddressFormCore->submit - [line 111 - classes/checkout/CheckoutAddressesStep.php]
    106. 'firstname' => $this->getCheckoutSession()->getCustomer()->firstname,
    107. 'lastname' => $this->getCheckoutSession()->getCustomer()->lastname,
    108. ));
    109.
    110. if (isset($requestParams['saveAddress'])) {
    111. $saved = $this->addressForm->fillWith($requestParams)->submit();
    112. if (!$saved) {
    113. $this->step_is_current = true;
    114. $this->getCheckoutProcess()->setHasErrors(true);
    115. if ($requestParams['saveAddress'] === 'delivery') {
    116. $this->show_delivery_address_form = true;
  • CheckoutAddressesStepCore->handleRequest - [line 57 - classes/checkout/CheckoutProcess.php] - [1 Arguments]
    52. }
    53.
    54. public function handleRequest(array $requestParameters = array())
    55. {
    56. foreach ($this->getSteps() as $step) {
    57. $step->handleRequest($requestParameters);
    58. }
    59.
    60. return $this;
    61. }
    62.
  • CheckoutProcessCore->handleRequest - [line 200 - controllers/front/OrderController.php] - [1 Arguments]
    195. parent::initContent();
    196.
    197. $this->restorePersistedData($this->checkoutProcess);
    198. $this->checkoutProcess->handleRequest(
    199. Tools::getAllValues()
    200. );
    201.
    202. $presentedCart = $this->cart_presenter->present($this->context->cart);
    203.
    204. if (count($presentedCart['products']) <= 0 || $presentedCart['minimalPurchaseRequired']) {
    205. Tools::redirect('index.php?controller=cart');
  • OrderControllerCore->initContent - [line 201 - classes/controller/Controller.php]
    196. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    197. $this->initHeader();
    198. }
    199.
    200. if ($this->viewAccess()) {
    201. $this->initContent();
    202. } else {
    203. $this->errors[] = Tools::displayError('Access denied.');
    204. }
    205.
    206. if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
  • ControllerCore->run - [line 366 - classes/Dispatcher.php]
    361. if (isset($params_hook_action_dispatcher)) {
    362. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    363. }
    364.
    365. // Running controller
    366. $controller->run();
    367. } catch (PrestaShopException $e) {
    368. $e->displayMessage();
    369. }
    370. }
    371.
  • DispatcherCore->dispatch - [line 28 - index.php]
    23. * @license http://opensource.or...ses/osl-3.0.php Open Software License (OSL 3.0)
    24. * International Registered Trademark & Property of PrestaShop SA
    25. */
    26.
    27. require(dirname(__FILE__).'/config/config.inc.php');
    28. Dispatcher::getInstance()->dispatch();
 
 
 
No tengo campo obligatorio para el DNI...
 
Alguna idea????

Logro Resolverlo, me pasa igual

Link to comment
Share on other sites

  • 1 month later...
On 1/2/2018 at 2:04 PM, w3bsolutions said:

Eso es porque el campo DNI está vacío (igual ni sale en el formulario) pero está marcado como obligatorio. 

Revisen que esté desactivado en el panel de control Clientes > Direcciones, debajo de la lista hay un botón que pone "Set required fields for this section".

Link to comment
Share on other sites

hola, quizas puedas ayudarme. tengo un problema con id_country vació. lo tengo activado como pais en Localizacion, mas no necesito confirmacion de pais!

PrestaShopException]

La propiedad Address->id_country está vacía.
at line 944 in file classes/ObjectModel.php

939.             }
940. 
941.             $message = $this->validateField($field, $this->$field);
942.             if ($message !== true) {
943.                 if ($die) {
944.                     throw new PrestaShopException($message);
945.                 }
946.                 return $error_return ? $message : false;
947.             }
948.         }
949. 
Edited by Dafro (see edit history)
Link to comment
Share on other sites

16 hours ago, Dafro said:

hola, quizas puedas ayudarme. tengo un problema con id_country vació. lo tengo activado como pais en Localizacion, mas no necesito confirmacion de pais!

PrestaShopException]

La propiedad Address->id_country está vacía.
at line 944 in file classes/ObjectModel.php


939.             }
940. 
941.             $message = $this->validateField($field, $this->$field);
942.             if ($message !== true) {
943.                 if ($die) {
944.                     throw new PrestaShopException($message);
945.                 }
946.                 return $error_return ? $message : false;
947.             }
948.         }
949. 

Respecto a: "La propiedad Address->id_country está vacía" posiblemente sea por el formato de la dirección.

Chequea este enlace que me he encontrado en Google -> https://victor-rodenas.com/2017/12/06/error-pais-address-id_country-empty-en-el-formulario-de-registro-de-prestashop/

 

 

Link to comment
Share on other sites

  • 5 months later...
  • 1 month 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...