A
A
alex steel2019-04-06 00:22:39
opencart
alex steel, 2019-04-06 00:22:39

How to select active language in opencart?

How to highlight an active language? You need to set for example font-weight: bold; Now they are displayed without highlighting, just grew / Ukrainian
5ca7c6aa724ad877849859.png
Here is the code from language.tpl

<?php if (count($languages) > 1) { ?>
<div class="pull-right">
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-language">
    <div class="btn-group">
      <div style="display: flex">
        <?php foreach ($languages as $language) { ?>
        <span><button class="btn btn-link btn-block language-select" type="button" name="<?php echo $language['code']; ?>"> <?php echo $language['name']; ?></button></span>
        <?php } ?>
      </div>
    </div>
    <input type="hidden" name="code" value="" />
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
  </form>
</div>
<?php } ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2019-04-08
@alexsteel07

<span>
  <button class="btn btn-link btn-block language-select <?php echo $language['code'] == $code ? 'active' : '';?>" type="button" name="<?php echo $language['code']; ?>"> 
    <?php echo $language['name']; ?>
  </button>
</span>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question