首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Magento Category Hierarchy的Fishpig Wordpress扩展

Magento Category Hierarchy的Fishpig Wordpress扩展
EN

Stack Overflow用户
提问于 2014-09-27 17:41:12
回答 1查看 547关注 0票数 0

我在一个Magento网站上工作,该网站使用了Fishpig扩展。我们在左侧边栏中显示了Categories小部件&它被设置为显示层次结构。

它工作在两个级别(即ul &li与.level0 & .level1),但没有显示类别3个级别的深度,即level2

我已经在一个基本的wordpress安装上进行了测试,我可以让它显示3级以下的类别,但我不能让它在Magento上与鱼猪WordPress集成工作。我已经分配了所有的子类别的帖子。

我在template/wordpress/sidebar/widget/categories.phtml中看到有这样一个代码块来获取level1子类别:

代码语言:javascript
复制
<?php else: ?>
        <?php foreach($categories as $category): ?>
            <li class="level0 item<?php if ($this->isCurrentCategory($category)): ?> active<?php endif; ?>">
                <a  class="level0" href="<?php echo $category->getUrl() ?>" title="<?php echo $category->getName() ?>">
                    <?php echo $category->getName() ?>
                </a><?php if ($this->getCount()): ?> (<?php echo $category->getPostCount() ?>)<?php endif; ?>
                <?php if ($this->getHierarchical()): ?>
                    <?php $children = $children = $category->getChildrenCategories() ?>
                    <?php if (count($children) > 0): ?>
                        <ul class="level1">
                            <?php foreach($children as $child): ?>
                                <?php if ($child->getPostCount() > 0): ?>
                                <li class="level1 item<?php if ($this->isCurrentCategory($child)): ?> active<?php endif; ?>">
                                    &raquo; <a href="<?php echo $child->getUrl() ?>" title="<?php echo $child->getName() ?>" class="level1"><?php echo $child->getName() ?></a><?php if ($this->getCount()): ?> (<?php echo $child->getPostCount() ?>)<?php endif; ?>
                                </li>
                                <?php endif; ?>
                            <?php endforeach; ?>
                        </ul>
                    <?php endif; ?>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    <?php endif; ?>

有没有办法在Magento上显示超过两个级别的wordpress类别?

EN

回答 1

Stack Overflow用户

发布于 2014-09-27 19:17:56

我更新了template/wordpress/sidebar/widget/categories.phtml以包含第三级,并且它起作用了:)

代码语言:javascript
复制
<?php foreach($categories as $category): ?>
    <li class="level0 item<?php if ($this->isCurrentCategory($category)): ?> active<?php endif; ?>">
        <a  class="level0" href="<?php echo $category->getUrl() ?>" title="<?php echo $category->getName() ?>">
            <?php echo $category->getName() ?>
        </a><?php if ($this->getCount()): ?> (<?php echo $category->getPostCount() ?>)<?php endif; ?>
        <?php if ($this->getHierarchical()): ?>
            <?php $children = $children = $category->getChildrenCategories() ?>
            <?php if (count($children) > 0): ?>
                <ul class="level1">
                    <?php foreach($children as $child): ?>
                        <?php if ($child->getPostCount() > 0): ?>
                        <li class="level1 item<?php if ($this->isCurrentCategory($child)): ?> active<?php endif; ?>">
                            &raquo; <a href="<?php echo $child->getUrl() ?>" title="<?php echo $child->getName() ?>" class="level1"><?php echo $child->getName() ?></a><?php if ($this->getCount()): ?> (<?php echo $child->getPostCount() ?>)<?php endif; ?>
                                      <?php $children2 = $children2 = $child->getChildrenCategories() ?>
                                      <?php if (count($children2) > 0): ?>
                                          <ul class="level2">
                                              <?php foreach($children2 as $child2): ?>
                                                  <?php if ($child2->getPostCount() > 0): ?>
                                                      <li class="level12 item<?php if ($this->isCurrentCategory($child2)): ?> active<?php endif; ?>">
                                                          &raquo; <a href="<?php echo $child2->getUrl() ?>" title="<?php echo $child2->getName() ?>" class="level1"><?php echo $child2->getName() ?></a><?php if ($this->getCount()): ?> (<?php echo $child2->getPostCount() ?>)<?php endif; ?>
                                                      </li>
                                                  <?php endif; ?>
                                              <?php endforeach; ?>
                                          </ul>
                                      <?php endif; ?>
                        </li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </ul>
            <?php endif; ?>
        <?php endif; ?>
    </li>
<?php endforeach; ?>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26073308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档