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

#   Namekey to associate different data

##

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

Less More

- Posts: 274
- Thank you received: 5
-
-
-
- [](http://www.deanimaconsulting.com)
-

15 years 10 months ago [\#4229](#4229) by [jameswadsworth](/forum/user/556-jameswadsworth "View jameswadsworth's Profile")  *[Namekey to associate different data](/forum/2-general-talk-about-hikashop/4229-namekey-to-associate-different-data#4229 "Hello,  we see that you are usually using namekeys to associated data from different tables together rather than auto-increment id field. Just out of interest what is the reasoning behind this? What are the pro and cons of doing so? It appears to make things slight more complicated, but the returned results are more human readable.  Yours curiously. James")* was created by *[jameswadsworth](/forum/user/556-jameswadsworth "View jameswadsworth's Profile")*

Hello,

we see that you are usually using namekeys to associated data from different tables together rather than auto-increment id field. Just out of interest what is the reasoning behind this? What are the pro and cons of doing so? It appears to make things slight more complicated, but the returned results are more human readable.

Yours curiously. James

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQyMjktbmFtZWtleS10by1hc3NvY2lhdGUtZGlmZmVyZW50LWRhdGE/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14280
-
-

15 years 10 months ago [\#4230](#4230) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Namekey to associate different data](/forum/2-general-talk-about-hikashop/4229-namekey-to-associate-different-data#4230 "Hello,  we see that you are usually using namekeys to associated data from different tables together rather than auto-increment id field. Just out of interest what is the reasoning behind this? What are the pro and cons of doing so? It appears to make things slight more complicated, but the returned results are more human readable.  Yours curiously. James")*

Hi,

Namekeys are used when we need to insert default data across several tables.
For example, for the zones, the data is inserted in both zone and zone_link tables.
If we wanted to use zone ids in the zone_link table, after import the 5000 zones during the install, we would have to load all the zones ids to insert the correct links in the zone_link table. To do that we need to match one column value with the correpsonding id. If you suppose that two zones could have the same name or same code (that happens for some states actually), you need something else which is unique, thus the namekey field.
Also, that can be a savior in some extreme cases: suppose that you delete all your zones but that you already had orders with addresses. If we had used zone ids to dynamically link the country and the state from the zone table, the information will be completely lost. With namekeys, even if the name isn't "nice" it still contains the name of the zone.
Also, there is still a zone id which is auto incremented as it is still used in some cases.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQyMjktbmFtZWtleS10by1hc3NvY2lhdGUtZGlmZmVyZW50LWRhdGE/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 274
- Thank you received: 5
-
-
-
- [](http://www.deanimaconsulting.com)
-

15 years 10 months ago [\#4233](#4233) by [jameswadsworth](/forum/user/556-jameswadsworth "View jameswadsworth's Profile")  Replied by *[jameswadsworth](/forum/user/556-jameswadsworth "View jameswadsworth's Profile")* on topic *[Re: Namekey to associate different data](/forum/2-general-talk-about-hikashop/4229-namekey-to-associate-different-data#4233 "Hello,  we see that you are usually using namekeys to associated data from different tables together rather than auto-increment id field. Just out of interest what is the reasoning behind this? What are the pro and cons of doing so? It appears to make things slight more complicated, but the returned results are more human readable.  Yours curiously. James")*

Thanks for the insight. I understand the logic. I will bear this in mind for future projects.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQyMjktbmFtZWtleS10by1hc3NvY2lhdGUtZGlmZmVyZW50LWRhdGE/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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.044 seconds

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