Magento2 如何设置Magento 2网站切换程序?

Magento2 如何设置Magento 2网站切换程序?,magento2,Magento2,我想用网站URL为多个网站magento2商店设置网站功能。还需要从“网站切换器”下拉列表中选择当前网站Id。您可以使用以下命令执行此操作:。。我只是在我目前的网站上这样做 <div class="switcher store switcher-store" id="switcher-store"> <strong class="label switcher-label"><span><?php echo __('Select Store') ?>

我想用网站URL为多个网站magento2商店设置网站功能。还需要从“网站切换器”下拉列表中选择当前网站Id。

您可以使用以下命令执行此操作:。。我只是在我目前的网站上这样做

<div class="switcher store switcher-store" id="switcher-store">
<strong class="label switcher-label"><span><?php echo __('Select Store') ?></span></strong>
<div class="actions dropdown options switcher-options">
    <?php foreach ($websites as $website): ?>
    <?php if ($websiteid == $website->getId()): ?>
        <div class="action toggle switcher-trigger"
             role="button"
             tabindex="0"
             data-mage-init='{"dropdown":{}}'
             data-toggle="dropdown"
             data-trigger-keypress-button="true"
             id="switcher-store-trigger">
            <strong>
                <span><?php echo $block->escapeHtml($website->getName()) ?></span>
            </strong>
        </div>
    <?php endif; ?>
    <?php endforeach; ?>
    <ul class="dropdown switcher-dropdown" data-target="dropdown">
        <?php foreach ($websites as $website): ?>
        <?php if (!($websiteid == $website->getId())): ?>
            <li class="switcher-option">
                <a href='<?php echo $website->getDefaultStore()->getCurrentUrl() ?>'>
                    <?php echo $block->escapeHtml($website->getName()) ?>
                </a>
            </li>
        <?php endif; ?>
        <?php endforeach; ?>
    </ul>
</div>





谢谢

如何切换商店而不是网站。同时请告诉我该把代码放在哪里,我是Magento的新手。谢谢