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

#   \[ - Search Plugin - \] - Itemid &amp; Multilanguage

##

- **[likandev](/forum/user/9788-likandev "View likandev's Profile")**
- [![likandev's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9788.png)](/forum/user/9788-likandev "View likandev's Profile") Topic Author
- [ Offline](/forum/user/9788-likandev)

Less More

- Posts: 69
- Thank you received: 11
-
- [](http://likandevelopment.com)
-

14 years 1 week ago [\#74109](#74109) by [likandev](/forum/user/9788-likandev "View likandev's Profile")  *[\[ - Search Plugin - \] - Itemid &amp; Multilanguage](/forum/3-bug-report/74109-search-plugin-itemid-multilanguage#74109 "My site has to be in 2 languages ( or could be more.. ) and, I noticed in the default language that SEF URL's weren't working on the search results.  1. The all said: component/hikashop/product/... /category&#95;pathaway&#95;2?Itemid=###  I fixed that by specifying a Menu Item ID as mentioned in this other thread:   www.hikashop.com/en/forum/2-general-talk...b/post.html?do=reply  That seemed to work for a second...  If I only can specify 1 menu item id, the URLs will all be in one language only. ( that's my new problem ) and also, the links won't work because I have the menus set for one language each one.  My Menu configuration looks like this:  When I change the Itemid to the other menu language, I'm able to click and get correct URL's for the other language as well.  Note: doing the same for the checkout does the same in terms of language, it forces all users to certain SEF URL and language and in my case I get broken URLs.")* was created by *[likandev](/forum/user/9788-likandev "View likandev's Profile")*

My site has to be in 2 languages ( or could be more.. ) and, I noticed in the default language that SEF URL's weren't working on the search results.

1. The all said: component/hikashop/product/... /category_pathaway_2?Itemid=###

I fixed that by specifying a Menu Item ID as mentioned in this other thread: [ www.hikashop.com/en/forum/2-general-talk...b/post.html?do=reply](http://www.hikashop.com/en/forum/2-general-talk-about-hikashop/50424-re-breadcrumb/post.html?do=reply)

That seemed to work for a second...

If I only can specify 1 menu item id, the URLs will all be in one language only. ( that's my new problem ) and also, the links won't work because I have the menus set for one language each one.

My Menu configuration looks like this:  [ ![974](http://static1.likandevelopment.com/screencast/2012-11-04_2335.png) ](http://static1.likandevelopment.com/screencast/2012-11-04_2335.png "974")

When I change the Itemid to the other menu language, I'm able to click and get correct URL's for the other language as well.

Note: doing the same for the checkout does the same in terms of language, it forces all users to certain SEF URL and language and in my case I get broken URLs.

---

Eduardo Chongkan - Likan Development
[ ](http://likandevelopment.com)[ likandevelopment.com](http://likandevelopment.com)

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

- **[likandev](/forum/user/9788-likandev "View likandev's Profile")**
- [![likandev's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9788.png)](/forum/user/9788-likandev "View likandev's Profile") Topic Author
- [ Offline](/forum/user/9788-likandev)

Less More

- Posts: 69
- Thank you received: 11
-
- [](http://likandevelopment.com)
-

14 years 1 week ago -  14 years 1 week ago [\#74197](#74197) by [likandev](/forum/user/9788-likandev "View likandev's Profile")  Replied by *[likandev](/forum/user/9788-likandev "View likandev's Profile")* on topic *[Re: \[ - Search Plugin - \] - Itemid &amp; Multilanguage](/forum/3-bug-report/74109-search-plugin-itemid-multilanguage#74197 "My site has to be in 2 languages ( or could be more.. ) and, I noticed in the default language that SEF URL's weren't working on the search results.  1. The all said: component/hikashop/product/... /category&#95;pathaway&#95;2?Itemid=###  I fixed that by specifying a Menu Item ID as mentioned in this other thread:   www.hikashop.com/en/forum/2-general-talk...b/post.html?do=reply  That seemed to work for a second...  If I only can specify 1 menu item id, the URLs will all be in one language only. ( that's my new problem ) and also, the links won't work because I have the menus set for one language each one.  My Menu configuration looks like this:  When I change the Itemid to the other menu language, I'm able to click and get correct URL's for the other language as well.  Note: doing the same for the checkout does the same in terms of language, it forces all users to certain SEF URL and language and in my case I get broken URLs.")*

Update:

For resolving the problem with the search results links I made plugin so I can configure as many Itemids for as many languages I need.

Then, on the com_Search tmpl override, I pulled the plugin's params to see what ItemID I needed to use for the current language. It now works with my 2 languages and I think I will work if I add a new language.

The plugin is not for admins, is more for developers and customizers. I'm attaching it in case someone needs it.

Note: You can add more fields to the plugin by editing the XML. You can also use a different logic for determining the name of the param to be used.

*This attachment is hidden for guests.
Please log in or register to see it.*

The code I used in the com_search override (default_results.php) was:

On the First lines of the file:
Code:

$plugin = JPluginHelper::getPlugin('system', 'likan_hikashop_multilang'); $params = new JRegistry; $params-&gt;loadString($plugin-&gt;params); $localizedParamID = JText::_('LK_LOCALIZED_ITEM_ID'); // You need to add the fieldnamames to the language file(S) $localizedItemid = $params-&gt;get($localizedParamID);

Then, right before displaying each result:

Code:

&lt;?php if ( $result-&gt;href ) : // Added by Likan $hspattern = '/com_hikashop/'; if (preg_match($hspattern, $result-&gt;href)){ // This is a HS product, brand or category $pattern = '/Itemid=[0-9A-Za-z]*/'; $url_itemID = 'Itemid=' . $localizedItemid; if (preg_match($pattern, $result-&gt;href)) $result-&gt;href = preg_replace($pattern, $url_itemID, $result-&gt;href); else $result-&gt;href .= '&amp;' . $url_itemID; } ?&gt;

Note: On the foreach, I added a '&amp;' to the $result var, to modify it's actual content.
Code:

&lt;?php foreach ($this-&gt;results as &amp;$result) : ?&gt;

That worked for me. Please update this thread if you guys know how to do it in a better way.

---

Eduardo Chongkan - Likan Development
[ ](http://likandevelopment.com)[ likandevelopment.com](http://likandevelopment.com)

Last edit: 14 years 1 week ago by [likandev](/forum/user/9788-likandev "View likandev's Profile").

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

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

- **[likandev](/forum/user/9788-likandev "View likandev's Profile")**
- [![likandev's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9788.png)](/forum/user/9788-likandev "View likandev's Profile") Topic Author
- [ Offline](/forum/user/9788-likandev)

Less More

- Posts: 69
- Thank you received: 11
-
- [](http://likandevelopment.com)
-

13 years 9 months ago [\#86849](#86849) by [likandev](/forum/user/9788-likandev "View likandev's Profile")  Replied by *[likandev](/forum/user/9788-likandev "View likandev's Profile")* on topic *[Re: \[ - Search Plugin - \] - Itemid &amp; Multilanguage](/forum/3-bug-report/74109-search-plugin-itemid-multilanguage#86849 "My site has to be in 2 languages ( or could be more.. ) and, I noticed in the default language that SEF URL's weren't working on the search results.  1. The all said: component/hikashop/product/... /category&#95;pathaway&#95;2?Itemid=###  I fixed that by specifying a Menu Item ID as mentioned in this other thread:   www.hikashop.com/en/forum/2-general-talk...b/post.html?do=reply  That seemed to work for a second...  If I only can specify 1 menu item id, the URLs will all be in one language only. ( that's my new problem ) and also, the links won't work because I have the menus set for one language each one.  My Menu configuration looks like this:  When I change the Itemid to the other menu language, I'm able to click and get correct URL's for the other language as well.  Note: doing the same for the checkout does the same in terms of language, it forces all users to certain SEF URL and language and in my case I get broken URLs.")*

Note:

The above code worked for the search RESULT page only.

I was also using a Yootheme AJAX based search and today we noticed that in the secondary language, the Sanish URLs were broken because of a malformed SEF URL:

It was always returning:

es/**shop**/p/148-cartera-retro-floreada-cierre-pellizco/category_pathway-87

That URL should in fact be:

es/**catalogo**/p/148-cartera-retro-floreada-cierre-pellizco/category_pathway-87

This time, since the URL was comming from the Hikashop Plugin and the JS code was obfuscated, I needed to modify the product search pugin:

plugins/search/hikashop_products/hikashop_products.php

On line 240, I modified it as follows:
Code:

// Original //$item_id = $this-&gt;params-&gt;get('item_id',''); // Likan $lkplugin = JPluginHelper::getPlugin('system', 'likan_hikashop_multilang'); $lkparams = new JRegistry; $lkparams-&gt;loadString($lkplugin-&gt;params); $localizedParamID = JText::_('LK_LOCALIZED_ITEM_ID'); // You need to add the fieldnamames to the language file(S) $item_id = $lkparams-&gt;get($localizedParamID);

The Ajax search now works fine in both languages.

PS. I still need to do some work on the URL translations when you click on Language Options ( Switching Languages ) It is based on the same plugin.

In case you want to check the ajax or regular search: [ madecostarica.com/es/](http://madecostarica.com/es/)

---

Eduardo Chongkan - Likan Development
[ ](http://likandevelopment.com)[ likandevelopment.com](http://likandevelopment.com)

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

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

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