[Skip to main content](#vessel-content)

#   Dublicate user\_id

##

- **[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")**
- [![eileensemporium's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37550-eileensemporium "View eileensemporium's Profile") Topic Author
- [ Offline](/forum/user/37550-eileensemporium)

Less More

- Posts: 54
- Thank you received: 0
-
-

8 years 11 months ago -  8 years 11 months ago [\#282439](#282439) by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")  *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282439 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")* was created by *[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")*

I notice that there are several dublicated user_id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software Code:

SELECT jos_hikashop_order.order_created, jos_hikashop_user.user_sage_id, jos_hikashop_user.user_id, jos_hikashop_user.user_email, jos_hikashop_order.order_number, jos_hikashop_order.order_id, jos_hikashop_order.order_full_price, jos_hikashop_order.order_status, CONCAT(address_firstname,' ',address_lastname) AS &#96;name&#96;, jos_hikashop_payment.payment_name, jos_hikashop_orderstatus.grp FROM jos_hikashop_order INNER JOIN jos_hikashop_user ON jos_hikashop_user.user_id = jos_hikashop_order.order_user_id INNER JOIN jos_hikashop_payment ON jos_hikashop_payment.payment_type = jos_hikashop_order.order_payment_method INNER JOIN jos_hikashop_orderstatus ON jos_hikashop_orderstatus.orderstatus_name = jos_hikashop_order.order_status INNER JOIN jos_hikashop_address ON jos_hikashop_address.address_id = jos_hikashop_order.order_shipping_address_id

I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user_id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether

Last edit: 8 years 11 months ago by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile"). Reason: typo city

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

8 years 11 months ago [\#282441](#282441) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282441 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")*

Hi,

It's not possible to have different user_id for different users in HikaShop.
The reason is simple: the user_id column of the hikashop_user table is the primary key and thus all its entries have to be unique. That is enforced directly at the database level.
So unless you've modified the database structure, which you should do, it's not possible.

Now regarding the data consistency between the addresses, the users and the orders, it's possible there is a mismatch if you've imported from VM, especially with old versions of HikaShop where there weren't enough failsafes for strange cases of VM data structure.
But that shouldn't impact your results of that query for new orders of your HikaShop shop since the user_id from hikashop_user has to be the user who purchased the order and whose id is in order_user_id and the addreses have to be the addresses selected during the checkout.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")**
- [![eileensemporium's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37550-eileensemporium "View eileensemporium's Profile") Topic Author
- [ Offline](/forum/user/37550-eileensemporium)

Less More

- Posts: 54
- Thank you received: 0
-
-

8 years 11 months ago -  8 years 11 months ago [\#282541](#282541) by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")  Replied by *[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")* on topic *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282541 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")*

Thanks the problem seems to be if old VM users re-order.
This is a case where I have a duplicated user (708)
Code:

SELECT jos_hikashop_order.order_user_id, jos_hikashop_order.order_id, jos_hikashop_address.address_lastname FROM jos_hikashop_order INNER JOIN jos_hikashop_address ON jos_hikashop_address.address_id = jos_hikashop_order.order_shipping_address_id WHERE jos_hikashop_order.order_user_id = 708

order_user_id order_id address_lastname
708 9333 Moorhouse
708 36066 Partners
708 36067 Moorhouse

So we have three orders all pointing to user_id 708 which is incorrrect

How does Hikashop deal with this 'cause it works ok

user_id column of the hikashop_user is ok there are not any duplicates

Code:

SELECT jos_hikashop_user.user_id, jos_hikashop_user.user_cms_id FROM jos_hikashop_user WHERE user_id = 708

Correctly give one line/user

Last edit: 8 years 11 months ago by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

8 years 11 months ago [\#282568](#282568) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282568 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")*

Hi,

So then, supposing that the address is attached to the correct user, it's easy to fix that. Run that MySQL query:
UPDATE
jos_hikashop_order,
jos_hikashop_address
SET jos_hikashop_order.order_user_id = jos_hikashop_address.user_id
jos_hikashop_order
WHERE jos_hikashop_address.address_id = jos_hikashop_order.order_shipping_address_id

The query will take the user_id from the shipping address of the order to update it in the order so that it is consistent.
Now if the user_id is also wrong in the address, then I don't see a solution to fix that automatically since you can't know which order/address is for which user. You just know that orders with different addresses are assigned to the same user.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")**
- [![eileensemporium's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37550-eileensemporium "View eileensemporium's Profile") Topic Author
- [ Offline](/forum/user/37550-eileensemporium)

Less More

- Posts: 54
- Thank you received: 0
-
-

8 years 11 months ago -  8 years 11 months ago [\#282573](#282573) by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")  Replied by *[eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile")* on topic *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282573 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")*

Thanks, but how does Hikashop cope with the the duplicates, what query does it use to build the order page up e.g.

/administrator/index.php?option=com_hikashop&amp;ctrl=order&amp;task=edit&amp;cid[]=36171

As the data is always correct in the Hikashop page above ie correct user against the order and I can see my extra user fields too

The user id is not always correct in the address table for instance I have 2 user id 708 (and many others) in the address table

Last edit: 8 years 11 months ago by [eileensemporium](/forum/user/37550-eileensemporium "View eileensemporium's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

8 years 11 months ago [\#282577](#282577) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Dublicate user\_id](/forum/35-orders-management/892753-dublicate-user-id#282577 "I notice that there are several dublicated user&#95;id presumably because the site was imported from Virtuemart this doesn't cause me a problem normally however I'm using this code for some custom accounting software  I sometimes see the incorrect user - how does HIKASHOP query look so that the dublicate user&#95;id in the address table don't matter. I relaise that that one user may change his address - but the user ids point to different users altogether")*

Hi,

HikaShop uses the order_user_id there to load the user data of the order. So if it's correct on that page the id should also be correct in the database.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mjc1My1kdWJsaWNhdGUtdXNlci1pZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.061 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
