Php Magento:如何获取不同商店类别的URL?

Php Magento:如何获取不同商店类别的URL?,php,magento,Php,Magento,我有几种不同语言的不同店面视图,可以通过domain.com/de、domain.com/fr等进行访问 这些StoreView中使用了相同的类别(例如,domain.com/de/mensfooth、domain.com/fr/mensfooth——大多数类别名称都没有翻译,但这是问题之外的内容) 现在,我想生成一个站点地图,其中包含rel替代项: <loc>"http://domain.com/de/mensfashion"</loc> <xhtml:link

我有几种不同语言的不同店面视图,可以通过domain.com/de、domain.com/fr等进行访问

这些StoreView中使用了相同的类别(例如,domain.com/de/mensfooth、domain.com/fr/mensfooth——大多数类别名称都没有翻译,但这是问题之外的内容)

现在,我想生成一个站点地图,其中包含rel替代项:

<loc>"http://domain.com/de/mensfashion"</loc>
<xhtml:link rel="alternate" hreflang="fr" href="http://domain.com/fr/mensfashion"/>
...
但是,无论我尝试更改为下一个$fr_store_id,我都会为初始设置的存储获取相同的URL

我尝试了以下(任意组合和顺序):

Mage::app()->setCurrentStore($fr_store_id);

Mage::getModel('catalog/category')->setStoreId($fr_store_id)->load($category_id);

$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($fr_store_id);
但这一切似乎都没有起到任何作用,我一直在拿回德国队的成绩

我怀疑这与只加载一次的模型有关,即一些缓存问题,我很清楚,在生成一个包含数百个链接(每个链接有10个备选链接)的站点地图时,为每个链接访问数据库不是一个好主意。 任何帮助都将不胜感激


PS如果唯一有效的方法是SQL,那也值得赞赏。。。但是很想知道代码中是否有一个简单的解决方案。

你能试试Mage::getModel('catalog/category')->setRequestPath('''->setStoreId($fr\u store\u id)->load($category\u id);那不是编译。。。它不识别setStoreId?
Mage::app()->setCurrentStore($fr_store_id);

Mage::getModel('catalog/category')->setStoreId($fr_store_id)->load($category_id);

$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($fr_store_id);