Change language button by direct link

ThemeBurn SupportForumsOpenCart ThemesPavilion OpenCart ThemeChange language button by direct link

This topic has been marked as not resolved.

Hi
To generate seo links of language I created multistore.
I have a store with main language “es” and second store with main language “en”, I want to change the button function by direct links
Button Spanish from english site must have link “en.shop.com” and button English from spanish site must have “shop.com” but this nos work properly

I have this code in the template button

 <ul>
              <?php foreach ($languages as $language): ?>
              <?php if ($language['code'] != $code): ?>
              <li>
                <a href="javascript:;" data-language-code="<?php echo $language['code']; ?>">
                  <?php if ($tb_lang_flag): ?>
                  <img src="<?php echo $tbData->theme_catalog_image_url; ?>flags/<?php echo $language['image']; ?>" width="16" height="16" alt="<?php echo $language['name']; ?>" />
                  <?php endif; ?>
                  <?php if ($tb_lang_name): ?>
                  <?php echo $language['name']; ?>
                  <?php endif; ?>
                  <?php if ($tb_lang_code): ?>
                  <?php echo $language['code']; ?>
                  <?php endif; ?>
                </a>
              </li>
              <?php endif; ?>
              <?php endforeach; ?>
            </ul>

i change this code


<a href="javascript:;" data-language-code="<?php echo $language['code']; ?>">

for this


 <a href="
<?php 
                if($language['code']=="en"){
        echo "http://en.shop.com";
                }else{
        echo "http://www.shop.com";
                }
                ?>"
                data-language-code="<?php echo $language['code']; ?>">

but this not work properly, the spanish language is kept in both places, when at the second site defaults Spanish
but if i change the url by “javascript:;” work properly in both sites :S

Thanks in advanced

 wideru
August 26, 2015 at 5:47 pm #42871

Hi,

Can you try to:

1) Open catalog/view/theme/pavilion/javascript/common.js

2) Remove this code block:

$('#header .tb_widget_language, #main_navigation_row .tb_widget_language').on('click', '.tb_submenu a', function(e) {
  changeLanguage($(this));
});

BR,
ThemeBurn team

August 31, 2015 at 12:19 pm #42965
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.