Duplicated customer entries for same joomla-user

  • Posts: 62
  • Thank you received: 1
7 years 10 months ago #243011

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6
-- Browser(s) name and version -- : Chrome latest
-- Error-message(debug-mod must be tuned on) -- : Duplicate database entries (no actual error)

Hello,

In my hikashop I suddenly have duplicate entries as customers for each Joomla User. I am not sure when it happened, but when a customer logged in he had to re-enter all his addresses. To check as to why that was I noticed all my customers where in the database twice.

In the database I dit this query to make sure I wasn't missing anything.

SELECT MIN(user_id),MAX(user_id), user_email, user_cms_id, COUNT(*) FROM #__hikashop_user
GROUP BY user_cms_id
HAVING COUNT(*) > 1

And it showed 2 entries for each Joomla User.

Funny part is the new entries don't have any orders related to them. I checked with these queries:
SELECT * FROM cpgh15_hikashop_order WHERE order_user_id IN (SELECT MAX(user_id) FROM #__hikashop_user
GROUP BY user_cms_id
HAVING COUNT(*) > 1)

gives no result

and

SELECT * FROM cpgh15_hikashop_order WHERE order_user_id IN (SELECT MIN(user_id) FROM #__hikashop_user
GROUP BY user_cms_id
HAVING COUNT(*) > 1)

gives the expected result of many orders.

First question is offcourse, is this a known problem, can I prevent it from occurring again?
Second questions is, how can I fix this? Would deleting the duplicates suffice?

I would appreciate your assistance!

Kind regards,
Teeuwis Hillebrand

Please Log in or Create an account to join the conversation.

  • Posts: 81620
  • Thank you received: 13084
  • MODERATOR
7 years 10 months ago #243020

Hi,

I've never seen that.
The user_email field of the hikashop_user table is a unique field. And the email field of the users table of Joomla is also a unique field.
And HikaShop automatically synch the user_cms_id and the user_email in the hikashop_user table based on the changes made in the users table of Joomla.
This means that if you have two entries with the same user_cms_id in the table, they must also have the same user_email value but that's not possible since there is a unique key on the column. So you should not be able to have two entries for the same user_cms_id.
The only reason would be that the database structure has been tempered with, or some custom coding somewhere messing with the user entries.
Check that you still have the HikaShop user synchronization plugin activated in the Joomla plugins manager.
Check that you still have the unique key on the user_email column of the hikashop_user table.
Deleting the duplicates should help, but if some other stuff handling the user synch has been modified, the problem could resurface.
I can only provide hints at what to check but since no one else had that problem and that it should not happen with a normal HikaShop and Joomla setup, I can't say much more to help.

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
7 years 10 months ago #243042

Hi Nicolas,

It seems my database was a bit corrupt. In the structure it showed the two unique keys (user_cms_id and user_email) but I could manually insert a double easily.

I deleted all duplicates and then I removed the keys and re-added them, that made the table function normally again.

Thank you for the hints and tips!

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum