找到你要的答案

Q:Magento multiple stores - remove ?store= from url

Q:Magento多店-删除?从URL存储

I am trying to shorten the url when the frontend is being changed to a different language. I already managed to shorten it a bit through setting <?php echo $_lang->getCurrentUrl() ?> to <?php echo $_lang->getCurrentUrl(false) ?> but it still shows the $store=.

I just want my urls to be like that: domain.com/de and domain.com/en.

I am trying to shorten the url when the frontend is being changed to a different language. I already managed to shorten it a bit through setting <?php echo $ _lang - >;getcurrenturl() ?> to <?php echo $ _lang - >;getcurrenturl(假) ?> but it still shows the $store=.

我只是希望我的网址是这样的:domain.com/de和domain.com/en。

answer1: 回答1:

One possible solution is to change the your page/switch/languages.phtml file

Find the line that reads

echo $_lang->getCurrentUrl()

And replace with

echo $_lang->getCurrentUrl(false)

Option 2

Go to System -> Configuration -> Web -> URL Options and set the 'Add Shop Code to URLs' option to Yes

This will make the urls to the store appear like the following:

www.myshop.com/otherstore/

www.myshop.com/default/

To edit the names of your stores to be SEO friendly, go to System -> Manage Shops


Quelle: http://magento.stackexchange.com/questions/53386/magento-multistore-store-and-from-store-in-url/53426#53426

一个可能的解决方案是改变你的页面/开关/ languages.phtml文件

查找读取的行

echo $ _lang - >;getcurrenturl()

更换

echo $ _lang - >;getcurrenturl(假)

选项2

进入系统-配置- >;>;网络& gt;URL选项和设置“添加店铺代码URL”选项是

这将使URL的商店出现如下:

www.myshop.com/otherstore/

www.myshop.com/default/

编辑你的店的名字是搜索引擎友好,去系统>;管理店铺


您:HTTP:/ / Magento。StackExchange。COM /问题/ 53386 / Magento多层存储和从URL / 53426 # 53426店

answer2: 回答2:

Assuming your store code are 'de' and 'en' for the said stores, you just have to adapt your configuration under

System > Configuration > Web > Add Store Code to URLs

假设你的商店代码是“DE”和“EN”的商店,你只需要适应你的配置下

配置系统>;>;Web >;添加存储代码网址

answer3: 回答3:
<?php if(count($this->getStores())>1): ?>
<div class="language dropdown">
<div class="dropdown-toggle cover">
    <!--<div class="icon" style="background-image:url(<?php echo $this->getSkinUrl().'images/flags/' . $this->htmlEscape(Mage::app()->getStore()->getName() .'.png'); ?>)"></div>-->
    <div class="language-inner">
        <div class="value">
            <?php echo Mage::app()->getStore()->getName(); ?>
        </div>
    </div>
</div>

<div class="dropdown-menu left-hand" onchange="window.location.href=this.value">
    <?php foreach ($this->getStores() as $_lang): ?>
        <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
        <a href="<?php echo $_lang->getCurrentUrl(false) ?>" class="currency_icon<?php if($_lang->getId() == $this->getCurrentStoreId()):?> selected <?php endif; ?>">
            <!--<span class="icon" style="background-image:url(<?php echo $this->getSkinUrl().'images/flags/' . $this->htmlEscape($_lang->getName() .'.png'); ?>)"></span>-->
            <?php echo $this->htmlEscape($_lang->getName()); ?>
        </a>
    <?php endforeach; ?>
</div>

<?php if(count($this->getStores())>1): ?>
<div class="language dropdown">
<div class="dropdown-toggle cover">
    <!--<div class="icon" style="background-image:url(<?php echo $this->getSkinUrl().'images/flags/' . $this->htmlEscape(Mage::app()->getStore()->getName() .'.png'); ?>)"></div>-->
    <div class="language-inner">
        <div class="value">
            <?php echo Mage::app()->getStore()->getName(); ?>
        </div>
    </div>
</div>

<div class="dropdown-menu left-hand" onchange="window.location.href=this.value">
    <?php foreach ($this->getStores() as $_lang): ?>
        <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
        <a href="<?php echo $ _lang - >;getcurrenturl(假) ?>" class="currency_icon<?php if($_lang->getId() == $this->getCurrentStoreId()):?> selected <?php endif; ?>">
            <!--<span class="icon" style="background-image:url(<?php echo $this->getSkinUrl().'images/flags/' . $this->htmlEscape($_lang->getName() .'.png'); ?>)"></span>-->
            <?php echo $this->htmlEscape($_lang->getName()); ?>
        </a>
    <?php endforeach; ?>
</div>

php  magento  url  magento-1.9