D
D
Daniel_xxx2021-04-17 12:31:55
opencart
Daniel_xxx, 2021-04-17 12:31:55

How to insert a link to a subdomain in Opencart instead of choosing a language?

Good day.
Tell me how to insert a link to a subdomain in Opencart instead of choosing a language?
On the Opencart engine, the Journal 3 theme has a standard multilingual functionality. How, leaving the flags and the name of the languages, assign them links to subdomains and domains? Code from language.tpl file:

<div id="language" class="language">
    <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-language">
      <div class="dropdown drop-menu">
        <button type="button" class="dropdown-toggle" data-toggle="dropdown">
          <span class="language-flag-title">
            <span class="symbol"><img src="<?php echo $j3->imageToBase64('catalog/language/' . $current_language['code'] . '/' . $current_language['code'] . '.png'); ?>" width="16" height="11" alt="<?php echo $current_language['name']; ?>" title="<?php echo $current_language['name']; ?>"/></span>
            <span class="language-title"><?php echo $current_language['name']; ?></span>
          </span>
        </button>
        <div class="dropdown-menu j-dropdown">
          <ul class="j-menu">
            <?php foreach ($languages as $language): ?>
              <li>
                <a class="language-select" data-name="<?php echo $language['code']; ?>">
                  <span class="language-flag"><img src="<?php echo $j3->imageToBase64('catalog/language/' . $language['code'] . '/' . $language['code'] . '.png'); ?>" width="16" height="11" alt="<?php echo $language['name']; ?>" title="<?php echo $language['name']; ?>"/></span>
                  <span class="language-title-dropdown"><?php echo $language['name']; ?></span>
                </a>
              </li>
            <?php endforeach; ?>
          </ul>
        </div>
      </div>
      <input type="hidden" name="code" value=""/>
      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>"/>
    </form>
  </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
opencartbot, 2021-04-27
@Daniil_xxx

In line

<a class="language-select" data-name="<?php echo $language['code']; ?>">

add a link to the href="link" attribute.
For example:
<?php if ($language['code'] == 'en') { ?> href="англояз. сайт" <?php } elseif ($language['code'] == 'ru') { ?> href="рус. сайт" <?php } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question