Jump to content

"Unable to save addresses" if lastname is empty


Recommended Posts

Hello,

 

I have a strange issue, about lastname and name fields in one page guaest checkout.

 

As you know, after filling in customer_firstname and customer_lastname, same values are automatically transferred to firstname and lastname in delivery address.

 

If you just click save, after there values are filled in, everything works fine.

 

If you decide to change first/lastname in delivery address, and type a correct name, everything works fine too.

 

But if you leave first/lastname empty, or you include any numbers in it and click save, a technical error appears: "upable to save addresses":

lastname.png

 

It looks like these fields get validated, but in case, they didn't pass validation, error message is not icluded in regular error window, and technical error is returned.

 

If there is something wrong about validation of other fields, a regular error block appears (for example: here is 1 Error(s): 1. ... is required.)

 

What could be the reason for that?

And what would you suggest as a fix for that bug?

 

PS 1.5.5.0

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

can you try with this:

 

open classes/Customer.php

there is a object definition:

public static $definition = array(
'table' => 'address',
'primary' => 'id_address',
'fields' => array(
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'),
'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128),
'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128),
'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12),
'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64),
'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300),
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
),
);
 
 
remove  'required' => true, param from these fields, do the same in classes/Address.php
Link to comment
Share on other sites

Well, I have removed  'required' => true, as you said, but in this case both customer_first/lastname and first/lastname are not required anymore. So, an order can be placed without indicating first/last name. 

 

However I need these fields to be required.

 

Just, instead of returning technical error, I want a regular error to be displayed as for the other fields.

Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...