Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Default Language For My Store Rate Topic   - - - - -

 
  • jeta
  • Senior Member
  • Trial users
  • Join Date: 01-Apr 16
  • 153 posts

Posted 06 July 2016 - 07:19 AM #1

HI!

 

I have added a new language exept the english one and i have set this language as default both at the backend and at the frondend side. My store actually is closed since i am working with it, the problem is that when i open the store at my pc it opens in the language i have set as default but when i try to open it in incognito or in another pc the store opens in english. Very soon the store will be online and i want to show it in my default language and the english to be an optional language. What should i do? I would appreciate very much any help, Thanks



 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1249 posts

Posted 06 July 2016 - 08:53 AM #2

Before applying the default language cs-cart is checking the browser language on file 

app/functions/fn.init.php

5a1251788b394a698243a2d3b5f3d1f1.png

 

You can comment this checking and go direct to default language but this means to modify core files and on next upgrade you need to fix it again if the file has been changed ;)

 

to comment please edit file above

 

#before

function fn_init_language($params, $area = AREA)
{
    $default_language = Registry::get('settings.Appearance.' . fn_get_area_name($area) . '_default_language');

    $show_hidden_languages = $area != 'C' ? true : false;
    $avail_languages = fn_get_avail_languages($area, $show_hidden_languages);

    if (!empty($params['sl']) && !empty($avail_languages[$params['sl']])) {
        fn_define('CART_LANGUAGE', $params['sl']);
    } elseif (!fn_get_session_data('cart_language' . $area) && $_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', $_lc);
    } elseif (!fn_get_session_data('cart_language' . $area) && !empty($avail_languages[$default_language])) {
        fn_define('CART_LANGUAGE', $default_language);

    } elseif (($_c = fn_get_session_data('cart_language' . $area)) && !empty($avail_languages[$_c])) {
        fn_define('CART_LANGUAGE', $_c);

    } else {
        reset($avail_languages);
        fn_define('CART_LANGUAGE', key($avail_languages));
    }

...

#after

function fn_init_language($params, $area = AREA)
{
    $default_language = Registry::get('settings.Appearance.' . fn_get_area_name($area) . '_default_language');

    $show_hidden_languages = $area != 'C' ? true : false;
    $avail_languages = fn_get_avail_languages($area, $show_hidden_languages);

    if (!empty($params['sl']) && !empty($avail_languages[$params['sl']])) {
        fn_define('CART_LANGUAGE', $params['sl']);
    /*} elseif (!fn_get_session_data('cart_language' . $area) && $_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', $_lc);*/
    } elseif (!fn_get_session_data('cart_language' . $area) && !empty($avail_languages[$default_language])) {
        fn_define('CART_LANGUAGE', $default_language);

    } elseif (($_c = fn_get_session_data('cart_language' . $area)) && !empty($avail_languages[$_c])) {
        fn_define('CART_LANGUAGE', $_c);

    } else {
        reset($avail_languages);
        fn_define('CART_LANGUAGE', key($avail_languages));
    }

I hope that helps

 

 

Keep on smiling,

---
Valentin
part of hungryweb.net



 
  • jeta
  • Senior Member
  • Trial users
  • Join Date: 01-Apr 16
  • 153 posts

Posted 06 July 2016 - 09:30 AM #3

Thank you for your help, but when i try do add the */ as you said when i search for my store i get an error and the page doesn't open at all :(



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19845 posts

Posted 06 July 2016 - 02:19 PM #4

Try to use:

// elseif (!fn_get_session_data('cart_language' . $area) && $_lc = fn_get_browser_language($avail_languages)) {
//     fn_define('CART_LANGUAGE', $_lc);

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • jeta
  • Senior Member
  • Trial users
  • Join Date: 01-Apr 16
  • 153 posts

Posted 07 July 2016 - 11:57 AM #5

Thank you very much, i solved this issue :)