我已经在特定类别的多个类别上创建了一个按钮,并确保该类别本身不可见。请参阅以下代码:
<?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; ?>
这完全适用于网店的荷兰方面,但在英语方面,它在逻辑上链接到荷兰语页面。
我需要更改什么才能让它在英语方面识别并链接到英语类别?
答案 0 :(得分:0)
试试这个:
$category_url = Mage::getModel("catalog/category")
->setStoreId(Mage::app()->getStore()->getId())
->load(123)
->getUrl();