【问题标题】:Magento: creating link to category with multiple languagesMagento:使用多种语言创建指向类别的链接
【发布时间】:2014-05-20 09:01:02
【问题描述】:

我在多个类别上为特定类别创建了一个按钮,并确保它在该类别本身上不可见。见以下代码:

<?php
    $category = Mage::getModel('catalog/layer')->getCurrentCategory();
    $category_id = $category->getId();
    if(!($category_id == 123)):
    $category_url = Mage::getModel("catalog/category")->load(123)->getUrl();
?>
    <a href="<?php echo $category_url; ?>"><?php echo $this->__('View specific category') ?></a>
<?php endif; ?>

这在网上商店的荷兰语方面非常有效,但在英语方面,它在逻辑上链接到荷兰语页面。

我需要进行哪些更改才能使其识别出它在英文端并链接到英文类别?

【问题讨论】:

    标签: php magento url hyperlink translation


    【解决方案1】:

    试试这个:

    $category_url = Mage::getModel("catalog/category")
              ->setStoreId(Mage::app()->getStore()->getId())
              ->load(123)
              ->getUrl();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-23
      • 2017-05-08
      • 1970-01-01
      • 1970-01-01
      • 2010-09-07
      • 1970-01-01
      相关资源
      最近更新 更多