gpt4 book ai didi

magento - 如何在多商店 Magento 设置中获取请求路径以在 hreflang 中使用?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:46:00 26 4
gpt4 key购买 nike

我们想要获取请求路径来构建动态 URL

    public function countryStoresAlternateLinks(){
$stores = Mage::app()->getStores(false);
$countryAlternateLinks = '';
foreach($stores as $store) {
$countryAlternateLinks[] = '<link rel="alternate" hreflang="' . substr(Mage::getStoreConfig('general/locale/code', $store->getId()), 0, 2) . (Mage::getStoreConfig('general/country/default', $store->getId()) != '' ? "-" . Mage::getStoreConfig('general/country/default', $store->getId()) : '') . '" href="' . $store->getCurrentUrl(false) .'" />' . "\n";
}
return $countryAlternateLinks; }

给出以下输出:

    <link rel="alternate" hreflang="en-GB" href="http://our_domain.com/magento/thee/losse-        bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;___store=english" /> 
<link rel="alternate" hreflang="nl-NL" href="http://www.our_domain.nl/magento/thee/losse-bladthee/groene?___store=dutch" />
<link rel="alternate" hreflang="nl-BE" href="http://our_domain.com/magento/thee/losse-bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;___store=nl_be" />
<link rel="alternate" hreflang="fr-BE" href="http://our_domain.com/magento/thee/losse-bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;___store=fr_be" />

该函数将打印每个商店的基本 URL,但类别路径不会因每个商店 View 而改变,它会以相同的语言提醒。

*问题是 – 我们如何指定“href”以获取每个商店 View /语言的类别路径?*

这就是我们目前得到的“href="' . $store->getCurrentUrl(false) .'”有谁知道我们如何才能做到这一点?


感谢您的回复,但不完全是我们正在寻找的。也许我在第一条消息中没有解释清楚,抱歉。

最后我们要调用的是其他店铺的rewrite URL,例如:

代替:

    www.domain.com/cat1/sub2/info-english.html

我们想调用:

   www.domain.com/cat-fr/sub-fr/info-french.html

这在原来的英文商店里,所以我们有很好的干净链接?有没有办法在 Magento 中实现这一目标?

谢谢

最佳答案

  `Mage::getModel('catalog/category')
->setStoreId(each store id)
->load(YOUR_CATEGORY_ID);`

这将根据商店 ID 加载每个类别。获取网址

希望你得到了需要的东西

:)

关于magento - 如何在多商店 Magento 设置中获取请求路径以在 hreflang 中使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16220614/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com