2014-09-23 1 views
0

필터 기능을 통합하고 편집하고 싶습니다.Magento integrate filters

이 코드가 있습니다

<?php $_filters = $this->getFilters() ?> 
     <?php foreach ($_filters as $_filter): ?> 
      <?php if($_filter->getItemsCount()): ?> 
       <div class="option-combo <?php echo $this->__($_filter->getName()) ?>">   
        <ul class="filter option-set clearfix " data-filter-group="<?php echo $this->__($_filter->getName()) ?>"> 
         <li><h4><?php echo $this->__($_filter->getName()) ?> : </h4></li> 
         <li><a href="#filter-<?php echo $this->__($_filter->getName()) ?>-any" data-filter-value="" class="selected">All</a></li> 

          <?php echo $_filter->getHtml() ?>                 
        </ul> 
       </div>  

      <?php endif; ?> 
     <?php endforeach; ?>> 

을 그리고 그것은 작동하지만 다른 통근 PHTML 파일을 호출 할 해달라고 ($ _filter-에서 filter.phtml을> getHtml())하지만 난 코드를 복사 할 때 filter.phtml에서 다음과 같이 직접 내 메인 페이지로 이동하십시오 :

<?php $_filters = $this->getFilters() ?> 
<?php foreach ($_filters as $_filter): ?> 
    <?php if($_filter->getItemsCount()): ?> 
     <div class="option-combo <?php echo $this->__($_filter->getName()) ?>">   
      <ul class="filter option-set clearfix " data-filter-group="<?php echo $this->__($_filter->getName()) ?>"> 
       <li><h4><?php echo $this->__($_filter->getName()) ?> : </h4></li> 
       <li><a href="#filter-<?php echo $this->__($_filter->getName()) ?>-any" data-filter-value="" class="selected">All</a></li> 

        <!-- I want to remove this external call and paste directly the content in it --> 
        <?php //echo $_filter->getHtml() ?> 

        <?php foreach ($this->getItems() as $_item): ?> 

         <?php if ($_item->getCount() > 0): ?> 

          <?php $Clean = $_item->getLabel();  ?>                
          <li style="display:none"><a href="#filter-<?php echo $_item->getLabel() ?>-<?php echo $Clean ?>" data-filter-value=".<?php echo $Clean ?>"><?php echo $_item->getLabel() ?></a></li> 
          <li><a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a> 
         <?php else: echo $_item->getLabel() ?> 
        <?php endif; ?> 

        <?php if ($this->shouldDisplayProductCount()): ?> 
         (<?php echo $_item->getCount() ?>) 
        <?php endif; ?> 
        </li> 
       <?php endforeach ?> 
      </ul> 
     </div> 
    <?php endif; ?> 
<?php endforeach; ?> 

아무런 결과도 표시되지 않습니다 ... 그리고 오류가 없습니다! 당신은 코드 아래에 시도 할 수

답변

0

: -

<?php $_filters = $this->getFilters() ?> 
      <?php foreach ($_filters as $_filter): ?> 
      <?php if($_filter->getItemsCount()): ?> 
       <dt><?php echo $this->__($_filter->getName()) ?></dt> 
       <dd><?php echo $_filter->getHtml() ?></dd> 
      <?php else:?> 
       // here you can add own code 
      <?php endif; ?> 
      <?php endforeach; ?> 
+0

감사하지만 내 문제 그것은 내가 직접 내 주요 파일 (view.phtml)에 filter.phtml의 코드를 추가 할 수 있습니다. 그리고 그렇게하면 결과가 표시되지 않습니다. – Kaherdin

+0

view.phtml 파일은 무엇입니까? 카탈로그/카테고리/view.phtml에? –

+0

카탈로그/레이어/view.phtml – Kaherdin

관련 문제