2014-09-27 3 views
0

Я работаю над сайтом Magento, который использует расширение Fishpig Wordpress. У нас есть виджет «Категории», отображаемый на левой боковой панели &, для отображения иерархии.Fishpig Wordpress Extension для иерархии категорий Magento

enter image description here

Он работает на двух уровнях глубоких (т.е. уль & Ли с .level0 & .level1), но не показывающим категории 3 уровня глубоко т.е. level2

Я проверил это на базовой установке WordPress и я могу заставить его отображать категории 3 уровня, но я не могу заставить его работать на Magento с интеграцией WordPress с помощью fishpig. Я назначил должности во все подкатегории.

Я вижу в template/wordpress/sidebar/widget/categories.phtml, что этот блок кода, чтобы получить level1 дочерние категории:

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

Есть ли способ, чтобы отобразить более двух уровней WordPress категорий на Magento с Fishpig?

ответ

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; ?> 
Смежные вопросы