kristo1980 Posted June 4, 2016 Share Posted June 4, 2016 Hello, when the customer registers, he can not add his address, the form page address is refreshed but does not move to the next step. I did a clean reinstall of my site but it does not solve the problem 3 days ago I tried all unsuccessful solutions help me please http:www.svaposhop.fryou can create an account to see the problem Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 I activate the debug this does not work I changed my hosting it also gives nothing Link to comment Share on other sites More sharing options...
jllramos Posted June 4, 2016 Share Posted June 4, 2016 Hello, Have you tried to add simple registration? Preferences > Customers > Registration process type -> Only account creation Then, in cart process, customer can add the address and maybe the problem is solve there. <- This module allow you to transforms visitors into customers -> Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 Thank you jll ramos I also tried it, it does not always work Link to comment Share on other sites More sharing options...
jllramos Posted June 4, 2016 Share Posted June 4, 2016 I just registered and it send me to My account. With email [email protected] What is the problem? Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 yes but you can not place your order Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 it remains this page http://www.svaposhop.fr/adresse?back=http%3A%2F%2Fwww.svaposhop.fr%2Fcommande%3Fstep%3D1&id_address=0 Link to comment Share on other sites More sharing options...
jllramos Posted June 4, 2016 Share Posted June 4, 2016 Ok, And the data were save in database? In ps_address table? Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 (edited) . Edited June 4, 2016 by shop1980 (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 (edited) . Edited June 4, 2016 by shop1980 (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 yes the data is stored in the database Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 the address is registered in the backoffice and the database, problem is that the client can not go to the next step, it still remains on the address form Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 the customer can not put aperture address or add another address Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 still no solution, a track ?? Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 (edited) quand je me met en mode one page j'obtiens ce message " Erreur : veuillez choisir une adresse" juste après avoir cliquer sur enregistrer, pourtant l'adresse c'est bien ajouter dans le back office et dans la base de donnée Edited June 4, 2016 by shop1980 (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 help !! Link to comment Share on other sites More sharing options...
jllramos Posted June 4, 2016 Share Posted June 4, 2016 (edited) It's very strange. The first thing I always try first is: Delete file: cache/class_index.php Delete all files in smarty/cache and smarty/compile <- This module allow you to transforms visitors into customers -> Edited June 4, 2016 by jllramos (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 when I show customer -> address in the backoffice and I click on an address, I find that all addresses are empty ?? Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 It's very strange. The first thing I always try first is: Delete file: cache/class_index.php Delete all files in smarty/cache and smarty/compile <- This module allow you to transforms visitors into customers -> thank you jll ramos I did all that too Link to comment Share on other sites More sharing options...
jllramos Posted June 4, 2016 Share Posted June 4, 2016 (edited) thank you jll ramos I did all that too After that I would go to AddressController maybe to function processSubmitAddress and check if all vars save data until $address->save (aproximately line 212) where data are saved. Then, if all is ok here I would go to class address and see save function. Then if all data are saved correctly I would go to getAddresses function in Customer class and check if sql function get address data... All of this if you know php and json.... Edited June 4, 2016 by jllramos (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 thank you again, I'll check it now Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 <?php /* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2016 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AddressControllerCore extends FrontController { public $auth = true; public $guestAllowed = true; public $php_self = 'address'; public $authRedirection = 'addresses'; public $ssl = true; /** * @var Address Current address */ protected $_address; protected $id_country; /** * Set default medias for this controller */ public function setMedia() { parent::setMedia(); $this->addJS(array( _THEME_JS_DIR_.'tools/vatManagement.js', _THEME_JS_DIR_.'tools/statesManagement.js', _PS_JS_DIR_.'validate.js' )); } /** * Initialize address controller * @see FrontController::init() */ public function init() { parent::init(); // Get address ID $id_address = 0; if ($this->ajax && Tools::isSubmit('type')) { if (Tools::getValue('type') == 'delivery' && isset($this->context->cart->id_address_delivery)) { $id_address = (int)$this->context->cart->id_address_delivery; } elseif (Tools::getValue('type') == 'invoice' && isset($this->context->cart->id_address_invoice) && $this->context->cart->id_address_invoice != $this->context->cart->id_address_delivery) { $id_address = (int)$this->context->cart->id_address_invoice; } } else { $id_address = (int)Tools::getValue('id_address', 0); } // Initialize address if ($id_address) { $this->_address = new Address($id_address); if (Validate::isLoadedObject($this->_address) && Customer::customerHasAddress($this->context->customer->id, $id_address)) { if (Tools::isSubmit('delete')) { if ($this->_address->delete()) { if ($this->context->cart->id_address_invoice == $this->_address->id) { unset($this->context->cart->id_address_invoice); } if ($this->context->cart->id_address_delivery == $this->_address->id) { unset($this->context->cart->id_address_delivery); $this->context->cart->updateAddressId($this->_address->id, (int)Address::getFirstCustomerAddressId(Context::getContext()->customer->id)); } Tools::redirect('index.php?controller=addresses'); } $this->errors[] = Tools::displayError('This address cannot be deleted.'); } } elseif ($this->ajax) { exit; } else { Tools::redirect('index.php?controller=addresses'); } } } /** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('submitAddress')) { $this->processSubmitAddress(); } elseif (!Validate::isLoadedObject($this->_address) && Validate::isLoadedObject($this->context->customer)) { $_POST['firstname'] = $this->context->customer->firstname; $_POST['lastname'] = $this->context->customer->lastname; $_POST['company'] = $this->context->customer->company; } } /** * Process changes on an address */ protected function processSubmitAddress() { $address = new Address(); $this->errors = $address->validateController(); $address->id_customer = (int)$this->context->customer->id; // Check page token if ($this->context->customer->isLogged() && !$this->isTokenValid()) { $this->errors[] = Tools::displayError('Invalid token.'); } // Check phone if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile')) { $this->errors[] = Tools::displayError('You must register at least one phone number.'); } if ($address->id_country) { // Check country if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country)) { throw new PrestaShopException('Country cannot be loaded with address->id_country'); } if ((int)$country->contains_states && !(int)$address->id_state) { $this->errors[] = Tools::displayError('This country requires you to chose a State.'); } if (!$country->active) { $this->errors[] = Tools::displayError('This country is not active.'); } $postcode = Tools::getValue('postcode'); /* Check zip code format */ if ($country->zip_code_format && !$country->checkZipCode($postcode)) { $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); } elseif (empty($postcode) && $country->need_zip_code) { $this->errors[] = Tools::displayError('A Zip/Postal code is required.'); } elseif ($postcode && !Validate::isPostCode($postcode)) { $this->errors[] = Tools::displayError('The Zip/Postal code is invalid.'); } // Check country DNI if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni')))) { $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); } elseif (!$country->isNeedDni()) { $address->dni = null; } } // Check if the alias exists if (!$this->context->customer->is_guest && !empty($_POST['alias']) && (int)$this->context->customer->id > 0) { $id_address = Tools::getValue('id_address'); if (Configuration::get('PS_ORDER_PROCESS_TYPE') && (int)Tools::getValue('opc_id_address_'.Tools::getValue('type')) > 0) { $id_address = Tools::getValue('opc_id_address_'.Tools::getValue('type')); } if (Address::aliasExist(Tools::getValue('alias'), (int)$id_address, (int)$this->context->customer->id)) { $this->errors[] = sprintf(Tools::displayError('The alias "%s" has already been used. Please select another one.'), Tools::safeOutput(Tools::getValue('alias'))); } } // Check the requires fields which are settings in the BO $this->errors = array_merge($this->errors, $address->validateFieldsRequiredDatabase()); // Don't continue this process if we have errors ! if ($this->errors && !$this->ajax) { return; } // If we edit this address, delete old address and create a new one if (Validate::isLoadedObject($this->_address)) { if (Validate::isLoadedObject($country) && !$country->contains_states) { $address->id_state = 0; } $address_old = $this->_address; if (Customer::customerHasAddress($this->context->customer->id, (int)$address_old->id)) { if ($address_old->isUsed()) { $address_old->delete(); } else { $address->id = (int)$address_old->id; $address->date_add = $address_old->date_add; } } } if ($this->ajax && Configuration::get('PS_ORDER_PROCESS_TYPE')) { $this->errors = array_unique(array_merge($this->errors, $address->validateController())); if (count($this->errors)) { $return = array( 'hasError' => (bool)$this->errors, 'errors' => $this->errors ); $this->ajaxDie(Tools::jsonEncode($return)); } } // Save address if ($result = $address->save()) { // Update id address of the current cart if necessary if (isset($address_old) && $address_old->isUsed()) { $this->context->cart->updateAddressId($address_old->id, $address->id); } else { // Update cart address $this->context->cart->autosetProductAddress(); } if ((bool)Tools::getValue('select_address', false) == true || (Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE'))) { $this->context->cart->id_address_invoice = (int)$address->id; } elseif (Configuration::get('PS_ORDER_PROCESS_TYPE')) { $this->context->cart->id_address_invoice = (int)$this->context->cart->id_address_delivery; } $this->context->cart->update(); if ($this->ajax) { $return = array( 'hasError' => (bool)$this->errors, 'errors' => $this->errors, 'id_address_delivery' => (int)$this->context->cart->id_address_delivery, 'id_address_invoice' => (int)$this->context->cart->id_address_invoice ); $this->ajaxDie(Tools::jsonEncode($return)); } // Redirect to old page or current page if ($back = Tools::getValue('back')) { if ($back == Tools::secureReferrer(Tools::getValue('back'))) { Tools::redirect(html_entity_decode($back)); } $mod = Tools::getValue('mod'); Tools::redirect('index.php?controller='.$back.($mod ? '&back='.$mod : '')); } else { Tools::redirect('index.php?controller=addresses'); } } $this->errors[] = Tools::displayError('An error occurred while updating your address.'); } /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $this->assignCountries(); $this->assignVatNumber(); $this->assignAddressFormat(); // Assign common vars $this->context->smarty->assign(array( 'address_validation' => Address::$definition['fields'], 'one_phone_at_least' => (int)Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'onr_phone_at_least' => (int)Configuration::get('PS_ONE_PHONE_AT_LEAST'), //retro compat 'ajaxurl' => _MODULE_DIR_, 'errors' => $this->errors, 'token' => Tools::getToken(false), 'select_address' => (int)Tools::getValue('select_address'), 'address' => $this->_address, 'id_address' => (Validate::isLoadedObject($this->_address)) ? $this->_address->id : 0 )); if ($back = Tools::getValue('back')) { $this->context->smarty->assign('back', Tools::safeOutput($back)); } if ($mod = Tools::getValue('mod')) { $this->context->smarty->assign('mod', Tools::safeOutput($mod)); } if (isset($this->context->cookie->account_created)) { $this->context->smarty->assign('account_created', 1); unset($this->context->cookie->account_created); } $this->setTemplate(_PS_THEME_DIR_.'address.tpl'); } /** * Assign template vars related to countries display */ 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 */ protected function assignAddressFormat() { $id_country = is_null($this->_address)? (int)$this->id_country : (int)$this->_address->id_country; $requireFormFieldsList = AddressFormat::getFieldsRequired(); $ordered_adr_fields = AddressFormat::getOrderedAddressFields($id_country, true, true); $ordered_adr_fields = array_unique(array_merge($ordered_adr_fields, $requireFormFieldsList)); $this->context->smarty->assign(array( 'ordered_adr_fields' => $ordered_adr_fields, 'required_fields' => $requireFormFieldsList )); } /** * Assign template vars related to vat number * @todo move this in vatnumber module ! */ protected function assignVatNumber() { $vat_number_exists = file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); $vat_number_management = Configuration::get('VATNUMBER_MANAGEMENT'); if ($vat_number_management && $vat_number_exists) { include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); } if ($vat_number_management && $vat_number_exists && VatNumber::isApplicable((int)Tools::getCountry())) { $vat_display = 2; } elseif ($vat_number_management) { $vat_display = 1; } else { $vat_display = 0; } $this->context->smarty->assign(array( 'vatnumber_ajax_call' => file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'), 'vat_display' => $vat_display, )); } public function displayAjax() { if (count($this->errors)) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors ); $this->ajaxDie(Tools::jsonEncode($return)); } } } here is my AddressController.php can anyone see what's wrong Link to comment Share on other sites More sharing options...
kristo1980 Posted June 4, 2016 Author Share Posted June 4, 2016 in my customer account when I click on my address, I came across this error message: Notice: Undefined index: alias in /home/speegmkd/public_html/www/cache/smarty/compile/1a/bc/f8/1abcf87d0208b991600c6f71a2c26911c06e394d.file.addresses.tpl.php on line 78Then when I click on update or delete I get a blank page with this message [Debug] This page has movedPlease use the following URL instead: https://www.mydomaine.com/adresse Link to comment Share on other sites More sharing options...
erouvier29 Posted June 5, 2016 Share Posted June 5, 2016 (edited) Your controller is ok (same as fresh 1.6.1.5). One way to reproduce the situation of your shop is to alter table ps_address by removing both the AUTO_INCREMENT option and the KEY constraint on column id_address. Can you check this (e.g. SHOW CREATE TABLE ps_address)? Edited June 5, 2016 by erouvier29 (see edit history) Link to comment Share on other sites More sharing options...
kristo1980 Posted June 5, 2016 Author Share Posted June 5, 2016 Your controller is ok (same as fresh 1.6.1.5). One way to reproduce the situation of your shop is to alter table ps_address by removing both the AUTO_INCREMENT option and the KEY constraint on column id_address. Can you check this (e.g. SHOW CREATE TABLE ps_address)? thank you very much erouvier29 you are the best Link to comment Share on other sites More sharing options...
psy_ch Posted February 16, 2022 Share Posted February 16, 2022 I came here because I experienced this behavior of address form continuously reloading without saving the address at all after an Update from 1.6 to 1.7. The problem for me was a missing entry in the database table prefix_hook (ps_hook). The hook "actionValidateCustomerAddressForm" was missing in this table and that lead to an address form-loop. Instructions: Go to your database (phpmyadmin), open table ps_hook search for an entry where the name equals "actionValidateCustomerAddressForm" - if an entry is found, this is not your solution (maybe check if the value for column "active" is set to 1) - if an entry is not found, continue with step 4: add a new entry into the ps_hook table with the content listed below under "Standard table entry..." Done, if that was your problem, the address form should be working fine now Database standard table entry for the hook:name = actionValidateCustomerAddressFormtitle = Customer address form validationdescription = This hook is called when a customer submits its address formactive = 1position = 1 2 Link to comment Share on other sites More sharing options...
conexionred Posted June 30, 2022 Share Posted June 30, 2022 Thank you. The same error for me and no logs or something that alarm!!! Link to comment Share on other sites More sharing options...
noemx Posted July 3 Share Posted July 3 On 2/16/2022 at 1:35 PM, psy_ch said: I came here because I experienced this behavior of address form continuously reloading without saving the address at all after an Update from 1.6 to 1.7. The problem for me was a missing entry in the database table prefix_hook (ps_hook). The hook "actionValidateCustomerAddressForm" was missing in this table and that lead to an address form-loop. Instructions: Go to your database (phpmyadmin), open table ps_hook search for an entry where the name equals "actionValidateCustomerAddressForm" - if an entry is found, this is not your solution (maybe check if the value for column "active" is set to 1) - if an entry is not found, continue with step 4: add a new entry into the ps_hook table with the content listed below under "Standard table entry..." Done, if that was your problem, the address form should be working fine now Database standard table entry for the hook:name = actionValidateCustomerAddressFormtitle = Customer address form validationdescription = This hook is called when a customer submits its address formactive = 1position = 1 Thanks a million! This worked for me as well. I was affected after migration from 1.6 to 8, so I'm assuming migration is broken because this worked before... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now