Extra unrelated addresses for customers in Hikashop

  • Posts: 71
  • Thank you received: 0
  • Hikashop Business Hikashop Essential
4 years 2 months ago #315142

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2.25

HI, several customers have reported that there are additional Shipping and Billing addresses in their profile that are completely unrelated to them. I have attached a screenshot below


Many customers have these rogue addresses on them. This appeared to occur several days ago and whilst we could get rid of them, will they return? I don't know where they have come from and a DB search shows that the extra addresses are only related to one user ID

Attachments:

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
4 years 2 months ago #315145

Hi,

Do you mean that every one is seeing the same ones ? Or different ones ?
Supposing that it's different ones, I suppose that either you've deleted users from the hikashop_user table at some point without removing the addresses in hikashop_address and thus the address there were pointing at an unexisting user entry.
Then, when someone creates a new account which gets affected to the same user id as one that was deleted before (it shouldn't happen unless the auto_increment of the hikashop_user table is reset, or you do a website migration of some kind), the user automatically sees these old addresses that have the same user id than his entry in hikashop_user.
Note that this could also happen with a migration from another ecommerce solution where the addresses / users were not migrated properly. Again, it means that the issue won't happen anymore in the future after you delete the unaffected addresses.
So this means that if you delete these unaffected address entries, it won't happen again.

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

  • Posts: 71
  • Thank you received: 0
  • Hikashop Business Hikashop Essential
4 years 1 month ago #315180

Each customer has different addresses as you guessed. This site has been up for several years now and was maybe was migrated when new, but I think the Hikashop install was newly developed and not imported from another component

I have never deleted addresses from the DB directly, about the only thing I could have done was delete Joomla Users who were "never logged in" from the User table but using the Joomla back-end to delete. Would this have caused the address missmatch?

If I delete the second addresses, how do I know that the next new user won't get an existing unattached address?

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
4 years 1 month ago #315183

Hi,

Normally, even if you delete users and don't delete addresses, the issue should not happen. That's because there is an auto increment value on the user id and thus it should only go up for new customers. So for example, if you have 2000 users and never deleted one, the next ID attributed to a new user should be 2002. If you delete the user with the id 1000 but not its addresses, then you have ghost addresses linked to a user entry with the id 1000 which doesn't exist anymore. But future users would still have their IDs above 2001 so new users should never ever see these ghost addresses.

Also, what you should do is delete from the hikashop_address table all the entries linked to an entry in hikashop_user which doesn't exist.
You can do that with such MySQL query in your PHPMyAdmin:

DELETE FROM #__hikashop_address as A
WHERE  A.address_user_id NOT IN (SELECT U.user_id FROM #__hikashop_user AS U);
where #__ is to be replaced by your table prefix.
That way, you'll be sure the next new users won't get existing ghost addresses attached to them.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum