Jump to content

Why I cannot change language in product page?


Recommended Posts

I have Prestashop 1.4 and I noticed a strange behaviour with languages: when I am on the main page I can change the language with no problems, but when I go to a product page, I cannot change to the different language; if I click other language, nothinh happens. So is this some kind of a bug or maybe some kind of a feature in PS??

Link to comment
Share on other sites

I just check my demo site is works fine.

You can see it here
http://expresscheckout.dyndns.org:8080/shop1417/product.php?id_product=8&id_lang=4

Please make sure you have created the data for different languages. If you have only input data for one language, then even you click the language, it will display the same data, so you will fell nothing changed.

You have to input different data for name/description at product detail page of back office.
Please click language icon (usually it is a flag icon), then select different language to input data for different language.

Link to comment
Share on other sites

I forgot to mention that this only happens when I have friendly URLs enabled, if I disable it then switching different languages in a priduct page works fine ... And yes, I know it sould be entered the data for all languages, if not then default language is used ... But when I click to a different language icon (flag) nothing happens, even these flags do not switch, so ...

Link to comment
Share on other sites

I just tried it with SEO friendly URL enabled, it is also working fine.
You can see it here
http://prestashop-addons.com/shop1417/

Is there any error happened when you click the language?
You can try set "display_errors" to 'on" to check it

Please also check link URL of language icons are correctly.
it should be something like below
http://prestashop-addons.com/shop1417/es/portatiles-apple/6-macbook.html

Also please check this
1. clear compile/cache folder to smarty (if you are using version 2, the folder name is smarty_2)
/tools/smarty/compile
/tools/smarty/cache
2. clear your browser cache

Link to comment
Share on other sites

I see than on your page it works correctly, on mine it works only if I disable friendly URLs.

I have enabled 'display_errors' but I see no errors. Where I should see these errors, if any?

URLs of language icons are correct.

I cleared compile and cache folder of smarty.

I cleared web browser cache.

Still no success, I find out that switching languages doesn't work only when I am on product page, if I am on main page, categories page, subcategories page, and any other pages language switching works normally ... Please help!

Link to comment
Share on other sites

have you tried to re-generate the .htaccess file?
I think maybe the rewrite rules is not generated correctly.


Already tried to regenerate it several times, but no success ...


I can confirm the same thing happens to me (and not only to me). The problem appeared after I had switched friendly URLs on. I am also looking for a solution to this. Thanks!
Link to comment
Share on other sites

spent the last 2 hours trying to get this working, i have same problem. I have never had so many problems with a shop upgrade in my life. i have many languages and i can change them everywhere on the site except when im on a product page.

Soon as i click a flag it will direct to the correct url i.e. if its latvian then /lv/, but the it will instantly switch back to the language i was just on.

If i delete this line from the htaccess then it works, but im no expert and i would think that this is important to keep -- RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /FAKEDIR/product.php?id_product=$1 [QSA,L]


Any ideas??

Link to comment
Share on other sites

spent the last 2 hours trying to get this working, i have same problem. I have never had so many problems with a shop upgrade in my life. i have many languages and i can change them everywhere on the site except when im on a product page.

Soon as i click a flag it will direct to the correct url i.e. if its latvian then /lv/, but the it will instantly switch back to the language i was just on.

If i delete this line from the htaccess then it works, but im no expert and i would think that this is important to keep -- RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /FAKEDIR/product.php?id_product=$1 [QSA,L]


Any ideas??


I do not have this line in .htaccess ... So has anyone found a fix for this?? It's really annoying bug ...
Link to comment
Share on other sites

Same problem here on a brand new 1.4.1.0

On an other directory + DB on the same server, I did 2 default scratch installations and the problem doesn't exist.

I'd say then, that some changes at some point in the global configuration of PS, "break" this "normal" behavior, but I don't know what... unfortunately.

I can confirm that commenting the line in .htaccess does indeed work (.htaccess generated automatically from the PS Tools).

For those who haven't seen the problem and want to check : go to http://www.onlinevoyages.com, choose any product, try 2 switch language between FR/EN. Same problem if you start with FR or EN.
If you change language on the home page or any CMS page or any category page, it works fine. Only product pages generate this problem.

sincerely
DJM

Link to comment
Share on other sites

error log file is on server root directory
however you can chk for any error if it exists by displaying error on the browser by chnaging the setting
ini_set(‘display_errors’, ‘off’)
to
ini_set(‘display_errors’, ‘on’)

in file config/config.inc.php

Link to comment
Share on other sites

I solved the problem ! (at least my problem)

I discovered that only 1 product wrongly configurated is enough to provoke this problem.

In my case, using an import software, a few products were created with a wrong default category assignment (product assigned to one category, different than the default category).

Hope it will help other people

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...

Hello,

 

I had the same problem and the fix posted here works for me:

http://www.prestashop.com/forums/topic/118466-solved-language-selector-not-working-on-product-details-pages/

 

Here is the link with 2 highlighted lines that needs to be deleted in /classes/Tools:

http://scm.prestashop.com/viewrep/PrestaShop_v.1.4.x/classes/Tools.php?r1=7849&r2=7852

 

Then regenerate .htaccess

Link to comment
Share on other sites

  • 4 months later...

Hello,

 

I had face this error and fixed it. Follow me.

 

There is a line in .htacces file like

 

RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]

 

I had change that to

 

RewriteRule ^[a-zA-Z0-9-]{3,}/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]

 

Now it's working fine. :mellow:

Link to comment
Share on other sites

×
×
  • Create New...