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

#   Front end router chooses wrong category due to not checking for locale

##

- **[fengel](/forum/user/37465-fengel "View fengel's Profile")**
- [![fengel's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37465.jpg)](/forum/user/37465-fengel "View fengel's Profile") Topic Author
- [ Offline](/forum/user/37465-fengel)

Less More

- Posts: 27
- Thank you received: 4
-
-

9 years 4 months ago [\#272235](#272235) by [fengel](/forum/user/37465-fengel "View fengel's Profile")  *[Front end router chooses wrong category due to not checking for locale](/forum/3-bug-report/890779-front-end-router-chooses-wrong-category-due-to-not-checking-for-locale#272235 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.7.2 -- PHP version -- : 7 -- Browser(s) name and version -- : Chrome 58  Summary The front end router does not constrain the URL query based on locale. It will search based on 'value' and pick the first result's reference&#95;id. If there exists multiple category aliases across different languages with the same value, the MySQL query will choose the result with the lowest id. This causes the route to point to, say reference&#95;id = 12, instead of the expected 13.  Steps to reproduce:  &#42; Create 2 categories under main product category: Jackets and Vests  &#42; Translate each of them. I have done them as the following:  &#42; Jackets =&gt; FR: Vestes, DA: Jakker  &#42; Vests =&gt; FR: Gilets, DA: Vestes  &#42; Attach some products to each category  &#42; In the front end, change locale to Danish. Click on 'Jakker'. The expected results show up  &#42; Click on 'Vestes'. The URL will say 'products/vestes', but the category module will highlight 'Jakker' as being active  &#42; Change the locale to French. Repeat the previous 2 steps (Vestes and Gilets, respectively). Each click will produce the correct expected results.  The queries in front/router.php function hikashop&#95;retrieve&#95;url&#95;id() do not check for langauge&#95;id.")* was created by *[fengel](/forum/user/37465-fengel "View fengel's Profile")*

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.7.2
-- PHP version -- : 7
-- Browser(s) name and version -- : Chrome 58

**Summary**
The front end router does not constrain the URL query based on locale. It will search based on 'value' and pick the first result's reference_id. If there exists multiple category aliases across different languages with the same value, the MySQL query will choose the result with the lowest id. This causes the route to point to, say reference_id = 12, instead of the expected 13.

Steps to reproduce:

1. Create 2 categories under main product category: Jackets and Vests
2. Translate each of them. I have done them as the following:
- Jackets =&gt; FR: Vestes, DA: Jakker
- Vests =&gt; FR: Gilets, DA: Vestes
3. Attach some products to each category
4. In the front end, change locale to Danish. Click on 'Jakker'. The expected results show up
5. Click on 'Vestes'. The URL will say 'products/vestes', but the category module will highlight 'Jakker' as being active
6. Change the locale to French. Repeat the previous 2 steps (Vestes and Gilets, respectively). Each click will produce the correct expected results.

The queries in front/router.php function hikashop_retrieve_url_id() do not check for langauge_id.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84OTA3NzktZnJvbnQtZW5kLXJvdXRlci1jaG9vc2VzLXdyb25nLWNhdGVnb3J5LWR1ZS10by1ub3QtY2hlY2tpbmctZm9yLWxvY2FsZT90bXBsPW1hcmtkb3du) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

9 years 4 months ago [\#272244](#272244) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Front end router chooses wrong category due to not checking for locale](/forum/3-bug-report/890779-front-end-router-chooses-wrong-category-due-to-not-checking-for-locale#272244 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.7.2 -- PHP version -- : 7 -- Browser(s) name and version -- : Chrome 58  Summary The front end router does not constrain the URL query based on locale. It will search based on 'value' and pick the first result's reference&#95;id. If there exists multiple category aliases across different languages with the same value, the MySQL query will choose the result with the lowest id. This causes the route to point to, say reference&#95;id = 12, instead of the expected 13.  Steps to reproduce:  &#42; Create 2 categories under main product category: Jackets and Vests  &#42; Translate each of them. I have done them as the following:  &#42; Jackets =&gt; FR: Vestes, DA: Jakker  &#42; Vests =&gt; FR: Gilets, DA: Vestes  &#42; Attach some products to each category  &#42; In the front end, change locale to Danish. Click on 'Jakker'. The expected results show up  &#42; Click on 'Vestes'. The URL will say 'products/vestes', but the category module will highlight 'Jakker' as being active  &#42; Change the locale to French. Repeat the previous 2 steps (Vestes and Gilets, respectively). Each click will produce the correct expected results.  The queries in front/router.php function hikashop&#95;retrieve&#95;url&#95;id() do not check for langauge&#95;id.")*

Hi,

Thank you for your feedback. I've added a patch on our end in order to take into account the current language.
Download the install package on our website and install it on yours and that should work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84OTA3NzktZnJvbnQtZW5kLXJvdXRlci1jaG9vc2VzLXdyb25nLWNhdGVnb3J5LWR1ZS10by1ub3QtY2hlY2tpbmctZm9yLWxvY2FsZT90bXBsPW1hcmtkb3du) 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.121 seconds

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

[](#top)
