Zen Cart Logo
Forums / Bug Reports / Multi-Language - "Home" button LINK alyways go back to default language

Multi-Language - "Home" button LINK alyways go back to default language

Views: 4,787

Results 1 to 9 of 9
13 Jan 2019, 7:28 PM
#1
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Multi-Language - "Home" button LINK alyways go back to default language

I upgraded my TEST website from 1.39H to 1.55f, everything works fine after few adjustments. This website is configure to support English and French language, the default language is "English".

I have a issue about the "Home / Accueil" button, the URL don't take care of language setting, it always go back to default language in "English". No issue in 1.39H.

Attachment 18266

TEST WEBSITE URL : https://www.pechesudv155.owally.com

Version of Zen Cart: 1.55F
PHP version: 5.6.39 (phpinfo.php is avalaible)
SSL: Yes

Plugin: French Language pack made from "English version"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I suppose the home button link is define inside TLP_HEADER.PHP
Line: 47 <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

My question is: How language code is set inside "home" button URL ? or Does someone else already had the same issue? how can I fix this ?

Thanks for your help
Pierre

15 Jan 2019, 4:19 AM
#2
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Re: Multi-Language - "Home" button LINK alyways go back to default language

I remark the "home" button link doesn't contains the last language selection made per the user, so when the browser display the main page, it use your browser default language.
Maybe it's better like this. But in 1.39H version, the URL contains the last language selection made per the user.

15 Jan 2019, 3:12 PM
#3
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,958
Plugin Contributions:
8

Re: Multi-Language - "Home" button LINK alyways go back to default language

pechesud:

I remark the "home" button link doesn't contains the last language selection made per the user, so when the browser display the main page, it use your browser default language.
Maybe it's better like this. But in 1.39H version, the URL contains the last language selection made per the user.

the problem is with your sessions. you are losing the session when pressing the home button.

not sure if you are on a different version of php; and i'm not a sessions expert. but if you add the previous session id to the home url you will still have the language selection.

15 Jan 2019, 9:36 PM
#4
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Re: Multi-Language - "Home" button LINK alyways go back to default language

carlwhat:

the problem is with your sessions. you are losing the session when pressing the home button.

not sure if you are on a different version of php; and i'm not a sessions expert. but if you add the previous session id to the home url you will still have the language selection.

I think, it's linked to my provider environment, I made a test on my PC with XAMPP, with the same PHP version, same code and database, everything works perfectly. Now, I need to find out how I can lose the SESSION ID on Linux?

15 Jan 2019, 10:36 PM
#5
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Re: Multi-Language - "Home" button LINK alyways go back to default language

pechesud:

I think, it's linked to my provider environment, I made a test on my PC with XAMPP, with the same PHP version, same code and database, everything works perfectly. Now, I need to find out how I can lose the SESSION ID on Linux?

I also noticed that when browsing through the catalog and overing the links, we see the URL defined at the bottom of the screen with the Zenid = xxxx, but if we pass the mouse over the "home" button, we do not see the Zenid only the website URL. Does someone know in which PHP program is defined?

16 Jan 2019, 11:10 PM
#6
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Re: Multi-Language - "Home" button LINK alyways go back to default language

pechesud:

I also noticed that when browsing through the catalog and overing the links, we see the URL defined at the bottom of the screen with the Zenid = xxxx, but if we pass the mouse over the "home" button, we do not see the Zenid only the website URL. Does someone know in which PHP program is defined?

In between, I made a PATCH inside this PHP code:

\includes\templates\pechesud\common\Tlp_header.php and tlp_footer.php

*<div id="navMainWrapper">

<div id="navMain"> <ul class="back"> <li><?php //------------------------------------------------------------------------------------------------------ // If session language is French, set value to french language, otherwise english // ------------------------------------------------------------------------------------------------------ if ($_SESSION['language']=='french') { echo '<a href="' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=index&language=fr">'; } else { echo '<a href="' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=index&language=en">'; } //------------------------------------------------------------------------------------ ?>
<?php echo HEADER_TITLE_CATALOG;*

\includes\classes\breadcrumbs.php

  • if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link']) && !$skip_link ) {
    // this line simply sets the "Home" link to be the domain/url, not main_page=index?blahblah:
    if ($this->_trail[$i]['title'] == HEADER_TITLE_CATALOG) {
    //------------------------------------------------------------------------------------------------------
    // If session language is french
    //------------------------------------------------------------------------------------------------------
    if ($_SESSION['language']=='french') {
    $trail_string .= ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=index&language=fr">' . $this->_trail[$i]['title'] . '</a>';}
    else
    {$trail_string .= ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=index&language=en">' . $this->_trail[$i]['title'] . '</a>';}
    //--------------------------------------------------------------------------------------------------------
    } else*
16 Jan 2019, 11:47 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Multi-Language - "Home" button LINK alyways go back to default language

In your cases of checking what language is being used, unless you have some reason to redirect one language that is installed to your system to another, you can simplify this and also ensure that it doesn't matter what language is installed:

HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=index&language=' . $_SESSION['languages_code']

Note I used a single quote at the end of the equals sign, but you may need to use a double quote depending on what was used to open that text.

17 Jan 2019, 2:37 AM
#8
trinity14 avatar

trinity14

Zen Follower

Join Date:
Jan 2014
Location:
Ontario, Canada
Posts:
252
Plugin Contributions:
3

Re: Multi-Language - "Home" button LINK alyways go back to default language

pechesud:

I also noticed that when browsing through the catalog and overing the links, we see the URL defined at the bottom of the screen with the Zenid = xxxx, but if we pass the mouse over the "home" button, we do not see the Zenid only the website URL. Does someone know in which PHP program is defined?
Hi Pechesud,
You are correct in mentioning that you will not see a zenid only the website url.

Double check that you have copied all the new language files where the default language files are. Also, make sure you have the current template files copied into the new language files.

This is where I had issues in the past.

17 Jan 2019, 2:46 AM
#9
pechesud avatar

pechesud

New Zenner

Join Date:
Jan 2019
Location:
montreal, canada
Posts:
6
Plugin Contributions:
0

Re: Multi-Language - "Home" button LINK alyways go back to default language

mc12345678:

In your cases of checking what language is being used, unless you have some reason to redirect one language that is installed to your system to another, you can simplify this and also ensure that it doesn't matter what language is installed:

HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=index&language=' . $_SESSION['languages_code']

> 
> Note I used a single quote at the end of the equals sign, but you may need to use a double quote depending on what was used to open that text.

Thanks everybody. But I resolved my issue, simply changing  HTTP_SERVER definition inside includes/configure.php, I forced "https://" prefix even it's supposed to be a "http://"

define('HTTP_SERVER', 'https://www.pechesudv155.owally.com'); define('HTTPS_SERVER', 'https://www.pechesudv155.owally.com');
Browsing product list "source code" inside FireFox, I remarked some links begun per "https:" and some per "http:" creating some strange results. Maybe it's also caused my hosting company who added some code inside my .htacces forcing "https://" usage everywhere, so I each time I click on a link with "http", a new session is created. .htaccess *RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC] RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$ RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule (.*) https://%1%{REQUEST_URI} [L,R=301]* :D:D:D