0

A question from beginner :-)

How can I modify .../templates/switch/languages.phtml from Magento 2.3 to show all Store Views from all websites?

For example,

site1.com have EN, DE languages

site2.com have RU, UA languages

I need to show all 4 languages at both websites

I've a code:

<div class="dropdown-block<?php echo $blockClasses; ?> dropdown-block-trigger lang-switcher<?php if ($id) echo ' lang-switcher' . $id; ?>" id="switcher-language<?php /* @escapeNotVerified */ echo $id?>">
<div class="dropdown-heading">
    <span class="inner-heading view-<?php echo $block->escapeHtml($block->getCurrentStoreCode()) ?>" title="<?php /* @escapeNotVerified */ echo __('Language') ?>">
        <span class="label dropdown-icon" style="background-image:url('<?php echo $currentFlagUrl; ?>');">&nbsp;</span>
        <span class="label"><?php echo $block->escapeHtml($block->getStoreName()) ?></span>
        <span class="caret"></span>
    </span>
</div>
<ul class="dropdown-content">
    <?php foreach ($block->getStores() as $_lang): ?>
        <?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
            <li class="view-<?php echo $block->escapeHtml($_lang->getCode()); ?> switcher-option">
                <a href="#" data-post='<?php /* @escapeNotVerified */ echo $block->getTargetStorePostData($_lang); ?>'><span class="label dropdown-icon" style="background-image:url('<?php echo $helperDesign->getFlagUrl($_lang->getCode()); ?>');">&nbsp;</span><?php echo $block->escapeHtml($_lang->getName()) ?></a>
            </li>
        <?php endif; ?>
    <?php endforeach; ?>
</ul>

  • Any suggestion? :-( – BSA Feb 24 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.