Jump to content

[SOLVED]Delete language iso from link


tozi
 Share

Recommended Posts

Hi all, i have 2 languages.

Link http://www.adac-pneu.cz/cs/

 

I have czech language http://www.adac-pneu.cz/cs/ and slovak http://www.adac-pneu.cz/sk/

 

What i need?

Delete cs/ from link. I tried this in httaccess but didnt work.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.adac-pneu.cz$

RewriteRule . - [E=REWRITEBASE:/]

RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

RewriteRule ^cs/(.*)$ /$1 [R=302,L]

 

I have presta 1.5.6.1. In BO i have default language czech.

Edited by tozi (see edit history)

Share this post


Link to post
Share on other sites

Prestashop automatically adds the language prefix when you have more than one language installed. 

 

So the easiest solution is to delete your second language (very probably english). Otherwise you will need to search for the code that checks how many languages are installed.

Share this post


Link to post
Share on other sites

Solution is:

modules/blocklanguages/blocklanguages.tpl

commented or delete this:

<script type="text/javascript">

$(document).ready(function () {

$("#countries").mouseover(function(){

$(this).addClass("countries_hover");

$(".countries_ul").addClass("countries_ul_hover");

});

$("#countries").mouseout(function(){

$(this).removeClass("countries_hover");

$(".countries_ul").removeClass("countries_ul_hover");

});

 

});

</script>

 

classes/Link.php (line 643)

replace this:

return Language::getIsoById($id_lang).'/';

 

with this:

if (Configuration::get('PS_LANG_DEFAULT') == $id_lang) {

return '';

}else{

return Language::getIsoById($id_lang).'/';

}

 

classes/Tools.php (line 396)

replace this:

if (($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int)Language::getIdByIso($iso)))

$_GET['id_lang'] = $id_lang;

 

with this:

if ( !( ($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int)Language::getIdByIso($iso)) ) ){

$_GET['id_lang'] = Configuration::get('PS_LANG_DEFAULT');

}else{

$_GET['id_lang'] = $id_lang;

}

 

Thats all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More