- Posts: 251
- Thank you received: 2
Product Url not translated completely
If I switch between Italian/English versions of my website, the product url of some items changes regulary but in other cases the url don't change completely.
Here an example:
Italian URL
www.hidesign.it/it/catalogo/product/show...-3344/poltrona-sacco
English URL
www.hidesign.it/en/catalogue/product/sho...3344/sacco-armachair
The URL I get switching from Italian to English is
www.hidesign.it/ en/catalogue/product/show/cid-3344/poltrona-sacco
This problem generate duplicated contents.
Please Log in or Create an account to join the conversation.
That's normal actually: The language switcher of Joomla when activated will redirect to the same page and just change the language tag in the URL. So it's normal that the product name in the URL is still the same.
Please Log in or Create an account to join the conversation.
In fact in some case the URL change in other case not...
That cause much problems of duplicated contents. This is not normal at all!!!
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
However, the redirection for the language change is done in the joomla language module: modules/mod_languages/helper.php
When I say that it's normal that it acts like that, I mean that it's just the way it's done in the language module of Joomla. I don't mean to say that it's the way it should be.
Please Log in or Create an account to join the conversation.
I was having the same problem. The Falang Module was only translating the /es /en part of the URL, leaving the rest in english / spanish, depending on what language I was using when viewing a product.
e.g.
madecostarica.com/en/shop/p/141-handbag-with-clasp-closure
madecostarica.com/es/catalogo/p/141-handbag-with-clasp-closure
I managed to get the correct URL by modifying the Falang Module, when translating from Spanish to English but, when I attempt to translate from English to Spanish, I can't get the correct product Name in SPANISH.
I use the HS helper to bring the product name in Spanish but, it seems it return the english produyct name, based on the language I'm using.
In the DB, the spanish name is in the hikashop_product table, while the englishg translation is in the falang_content table.
When I navigate in Spanish, it works because I get the english name from teh falang table and the spanish name from the HS table, but when I switch to english, HS brings the english name only.
How can I get the Spanish name using the HS Helper when navigating in English?
Thanks in advanced.
Eduardo Chongkan - Likan Development
likandevelopment.com
Please Log in or Create an account to join the conversation.
You will have to do the query yourself:
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__hikashop_product WHERE product_id='.$product_id);
$product = $db->loadObject('stdClass', true,'es-ES');
echo $product->product_name;
Please Log in or Create an account to join the conversation.
nicolas wrote: You can't use the HikaShop class for that because the query that is done by HikaShop is automatically converted by Falang so that you get the name in the current language.
You will have to do the query yourself:
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__hikashop_product WHERE product_id='.$product_id);
$product = $db->loadObject('stdClass', true,'es-ES');
echo $product->product_name;
Thanks, just a question, What is the es-ES param for?
BTW, I'm attaching my modified falang helper (modules/mod_falang/helper.php) in case someone wants to take a look into it.
The plugin it uses for getting the correct item IDs depending on the language is mentioned here:
www.hikashop.com/en/forum/3-bug-report/7...ilanguage.html#86849
You can see the URL translations working here (On products): madecostarica.com/
Eduardo Chongkan - Likan Development
likandevelopment.com
Please Log in or Create an account to join the conversation.
The es-ES parameter is for the language (spanish there).
Thanks for the file
Please Log in or Create an account to join the conversation.
I know it is the international language code for Spanish-Spain, my question was, why did you send it as a parameter to the loadObject Method?
I see the method only asks for 1 parameter:
Also, today I tested and the site was broken. I was sure I tested it last night and it worked, maybe some sort of cache..
I traced it down, and it seems the problem was in fact the extra parameters of the loadObject method, I checked the library method and I foudn what I put above, so I removed the parameters and used it as I normally use it. Joomla 2.5, not sure if 3.0 implements your method.
I'm curretnly using:
I also noticed that, if there was no translation available for a product in Falang, it would return an empty name. So I changed the helper file to use the default product name when no translation was found in Falang
Eduardo Chongkan - Likan Development
likandevelopment.com
Please Log in or Create an account to join the conversation.
The falang plugin overrides the database driver of joomla and all its database functions with its owns.
And it adds additional parameters to the functions.
One of the parameter is the language code, so that you can force it to load the data in a certain language.
See the code from the file plugins/system/falangdriver/falangdriver.php :
Please Log in or Create an account to join the conversation.