2012-08-14 2 views
0

상위 카테고리 페이지에 하위 카테고리 격자를 표시하려고합니다. this 튜토리얼을 따라 왔지만 모든 하위 카테고리에 이미지를 할당 했더라도 실제 페이지 대신 여전히 자리 표시 자 이미지가 표시된다는 사실을 제외하면 모든 것이 잘 작동합니다.magento 하위 카테고리 이미지를 검색 할 수 없습니다.

phtml 코드의 어딘가에 문제가 있다고 생각합니다.

// Retrieve the current category and it's children 
<?php 
$_maincategorylisting=$this->getCurrentCategory(); 
$_categories=$this->getCurrentChildCategories(); 
if($_categories->count()): 
    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); 
      $catName = $this->getCurrentCategory()->getName(); 
      $_imageUrl=$cur_category->getImageUrl(); 
      if (!$_imageUrl) : //if the image url is false set it to the placeholder 
       $_imageUrl = $this->getSkinUrl('images/catalog/product/placeholder/thumbnail.jpg'); 
      endif; 
      /* output */ ?> 
       <div class="category-box"> 
        <a href="<?php echo $this->getCategoryUrl($_category)?>"> 
         <img src="<?php echo $_imageUrl?>" height="80"> 
        </a> 
        <p><a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a></p> 
       </div> 
     <?php endif; 
    endforeach; 
    $layer->setCurrentCategory($_maincategorylisting); 
endif; ?> 

참고 : 나는 젠토 V를 실행하는거야

1.6.0.0

This 난에 테스트있어 카테고리 페이지입니다.

답변

1

나는 foreach 루프에서 항상 "Filtrare"카테고리를 반환하는 $ this-> getCurrentCategory()를 사용합니다.

는 기본적으로 foreach 루프에서 당신은 모든 곳에서 교체해야 $ this-> getCurrentCategory()와 $ cur_category

+0

난 당신의 제안을 따라,하지만 아무것도 나를 @Bogdan 하위 카테고리 이미지 – Bogdan

+0

으로 변경되지 내 팀 동료가 시도 자습서의 코드를 참조하십시오. 우리는 <를 사용하는 것과 같은 나쁜 php 스타일을 발견했습니다. 일부 PHP 코드?> 대신 를 사용하십시오. Magento 설치에서 매장보기를 몇 개나 할 수 있습니까? – ceckoslab

+0

또한 여기에 코드는이 스크립트 스타일 ""때문에 PHP의 일부 버전에서는 오류를 발생시키지 않는 형식으로되어 있습니다. https://gist.github.com/3359512 – ceckoslab