当我在侧边栏中列出类别时,我是magento的新手.当我点击类别名称意味着它将转到404错误页面.如果您有任何想法请尽快告诉我..
我的代码是
<?php
$_categories = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
?>
<li><a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><span class="categoriesHead"><?php
echo $this->htmlEscape($_category->getName()) ?></span>
</a>
</li>
<?php
endif;
endforeach;
endif;
?>
Run Code Online (Sandbox Code Playgroud)
我在1.5.1中遇到了同样的问题,在我的情况下,它是类别url后缀,它期望一个.html后缀,但链接给了我空白.我Admin>>System>>Configuration>>Catalog>>Search Engine Optimisations>>category suffix从".html"改为""(空白),现在工作正常.
| 归档时间: |
|
| 查看次数: |
14922 次 |
| 最近记录: |