2014-09-27 175 views
0

我正在使用Fishpig Wordpress擴展的Magento網站上工作。我們將「分類」小部件顯示在左側邊欄&中,它被設置爲顯示分層結構。Magento的Fishpig Wordpress擴展分類層次

enter image description here

據工作兩層深(即UL &李與.level0 & .level1),但沒有顯示類3級深即level2

我一個基本的WordPress安裝測試這我可以讓它顯示3個級別的類別,但我無法通過fishpig WordPress集成在Magento上運行它。我已將帖子分配給所有子類別。

template/wordpress/sidebar/widget/categories.phtml看到有這個代碼塊,以獲得1級子類別:

<?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; ?> 

是否有與Fishpig上的Magento顯示WordPress的類別超過兩級的方法嗎?

回答

1

我更新template/wordpress/sidebar/widget/categories.phtml包括一個3級和它的工作:)

<?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; ?> 
相關問題