Page 1 of 2
Assign telephone to the address pages
Posted: Fri Dec 23, 2022 2:06 pm
by cwh2000
During the checkout process on page: checkout_shipping_address.php
When selecting another address to ship an item to using the form under heading "Or use a new Address"
Submitting the form receive the error message:
<
Warning: DB: [1062] Duplicate entry '' for key 'uq_customers_email_address' from in /home/public_html/catalog/includes/system/versioned/1.0.8.1/database_core.php on line 44
1062 - Duplicate entry '' for key 'uq_customers_email_address'
INSERT INTO customers (customers_telephone) VALUES ('310-555-1224')
[PHOENIX FATAL]
Using the latest version 1.0.8.20
Re: Customers cannot add new delivery address at checkout
Posted: Fri Dec 23, 2022 3:38 pm
by heatherbell
Testing on a 1.0.8.20 test store we have also had errors:
Front end when updating an address in address book on address_book_process.php?edit
Warning: Undefined array key "customers" in C:\xampp8\htdocs\PhoenixCart-1.0.8.20\includes\system\versioned\1.0.5.1\customer_write.php on line 85
Warning: foreach() argument must be of type array|object, null given in C:\xampp8\htdocs\PhoenixCart-1.0.8.20\includes\system\versioned\1.0.8.6\query.php on line 108
Warning: DB: [1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 from in C:\xampp8\htdocs\PhoenixCart-1.0.8.20\includes\system\versioned\1.0.8.1\database_core.php on line 44
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
UPDATE customers SET customers_telephone = '01326999999' WHERE
[PHOENIX FATAL]
Also when adding new address on checkout_shipping_address.php
Warning: DB: [1062] Duplicate entry '' for key 'uq_customers_email_address' from in C:\xampp8\htdocs\PhoenixCart-1.0.8.20\includes\system\versioned\1.0.8.1\database_core.php on line 44
1062 - Duplicate entry '' for key 'uq_customers_email_address'
INSERT INTO customers (customers_telephone) VALUES ('')
[PHOENIX FATAL]
Re: Customers cannot add new delivery address at checkout
Posted: Fri Dec 23, 2022 4:38 pm
by cwh2000
It appears we have them same problem on both areas of the site.
Also, If I add a new entry to the address book it puts a blank entry into the customers table other than the phone number field that is populated.
Creating a new address at check for an existing different test user account received error:
<
Warning: array_filter() expects parameter 1 to be array, null given in /home/neperfmust/public_html/catalog/includes/system/versioned/1.0.5.1/customer.php on line 52
The same behavior in the database where the customers table has a blank new entry with only the phone number field populated. The address book table has a new entry pointing to this new customer table entry.
Re: Customers cannot add new delivery address at checkout
Posted: Tue Dec 27, 2022 12:50 pm
by ecartz
heatherbell wrote: ↑Fri Dec 23, 2022 3:38 pm
Also when adding new address on checkout_shipping_address.php
Warning: DB: [1062] Duplicate entry '' for key 'uq_customers_email_address' from in C:\xampp8\htdocs\PhoenixCart-1.0.8.20\includes\system\versioned\1.0.8.1\database_core.php on line 44
1062 - Duplicate entry '' for key 'uq_customers_email_address'
INSERT INTO customers (customers_telephone) VALUES ('')
[PHOENIX FATAL]
This suggests that someone would have to create a telephone field that was attached to the address table rather than the customers table. Because you seem to have added telephone to the address page, but the core telephone field is a customer-wide setting.
The easy fix for the error is to not assign telephone to the address pages.
A longer term fix would be for someone (e.g. a certified developer) to make a new telephone module that assigns to the address rather than the customer. People should use that instead of the core module if they want separate telephone numbers for each address.
I should probably fix the update error, but I lost my test site. So it may be a while before I'm able to work on it. Again, the near term solution is not to assign the core telephone module to the address page. Even if I fix it, it still won't do what you presumably want, which is to have a separate telephone per address.
Re: Customers cannot add new delivery address at checkout
Posted: Tue Dec 27, 2022 1:38 pm
by heatherbell
ecartz wrote: ↑Tue Dec 27, 2022 12:50 pm
The easy fix for the error is to not assign telephone to the address pages.
Many thanks for the explanation - all good now

Preview of 1.0.8.20
Posted: Wed Dec 28, 2022 6:32 am
by Moxamint
heatherbell wrote: ↑Tue Dec 27, 2022 1:38 pm
ecartz wrote: ↑Tue Dec 27, 2022 12:50 pm
The easy fix for the error is to not assign telephone to the address pages.
Many thanks for the explanation - all good now
Is the email address the same, that should not be assigned to the address pages, either?
In my case, it is preferable to be able to assign different telephone and email to the addresses as that is how my business works - the buyer is often different from the recipient, especially when it comes to a governmental purchase.
I did that for my old site running pre-Phoenix (Edge), which involves lots of core changes.
Re: Assign telephone to the address pages
Posted: Wed Dec 28, 2022 8:29 am
by Kofod95
Maybe this is helpful?
viewtopic.php?p=3636#p3636
Maybe a little out-dated (though I guess the general method should be the same), but I will need to update it at some point, so I will gladly contribute with what I can.
//Daniel
Re: Preview of 1.0.8.20
Posted: Wed Dec 28, 2022 10:12 am
by heatherbell
Moxamint wrote: ↑Wed Dec 28, 2022 6:32 am
Is the email address the same, that should not be assigned to the address pages, either?
If we understand correctly from ecartz's helpful post, yes, Email Address and Telephone modules are specific to Customer pages and will show on create_account and account_edit on the store side by default. Do not change this to add these to show on Address pages, that is, address_book and checkout_new_address which will result in breaking those pages.
If we further understand correctly, from Kofod's helpful post, for your suggested use case, additional columns should be added to your address_book table for email and telephone and additional customer_data modules made for those two.
Re: Assign telephone to the address pages
Posted: Wed Dec 28, 2022 10:51 am
by ecartz
The three that can be set either per address or per account: gender; first name; last name. Birthday, email, telephone, fax, password, and newsletter can only be set per account. Company, street, suburb/line 2, city, state, and country can only be set per address. It's possible that you could set the per address ones on an account by assigning them to the default address. I haven't tried that, so I don't know if it works by default.
It should not require core changes to modify this behavior, just new customer data modules and database changes.
Re: Assign telephone to the address pages
Posted: Wed Dec 28, 2022 12:01 pm
by heatherbell
ecartz wrote: ↑Wed Dec 28, 2022 10:51 am
It should not require core changes to modify this behavior, just new customer data modules and database changes.
Managed to create a new cd_telephone module that works to save a number to a new entry_telephone column in address_book table.
Now having trouble showing that on orders.php in admin.
Tried editing admin/includes/actions/orders/views/edit.php but failed.
Any pointers gratefully received.