2013-05-27 79 views
0

我在這一直以某種方式之前,但從來沒有這種情況在這裏發表問題。通常在App.php出現此錯誤,但對於我來說,發生在/httpdocs/app/design/frontend/default/theme/template/catalog/category/view.phtml上我如下所示線42。警告:get_class()預計參數1是對象,布爾給

有沒有人對修復這方面的任何想法?我有點茫然。

<?php 
    /** 
    * Category view template 
    * 
    * @see Mage_Catalog_Block_Category_View 
    */ 
    ?> 
    <?php 
    $_helper = $this->helper('catalog/output'); 
    $_category = $this->getCurrentCategory(); 
    $_imgHtml = ''; 

    $_category->setCanShowBlock(false); 
    $_category->setHasHeaderImage(false); 
    //////Line 42/////// if (get_class($this->getLayout()->getBlock('catalog.leftnav')) != 'Mage_Catalog_Block_Navigation') { 
     $_category->setCanShowBlock($this->getLayout()->getBlock('mana.catalog.leftnav')->canShowBlock()); 
    } 

    if ($_imgUrl = $_category->getImageUrl()) { 
     $_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" />'; 
     $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); 
     $_category->setHasHeaderImage(true); 
    } 
?> 

<?php /* 

<!-- <div class="page-title category-title"> 
    <?php if($this->IsRssCatalogEnable() && $this->IsTopCategory()): ?> 
     <a href="<?php echo $this->getRssLink() ?>" class="link-rss"><?php echo $this->__('Subscribe to RSS Feed') ?></a> 
    <?php endif; ?> 
    <h1><img src="<?php echo $this->getSkinUrl('images/' . $_helper->categoryAttribute($_category, $_category->getName(), 'name') . '.jpg') ?>" alt="<?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?>" /></h1> 
</div> --> 

*/ 

Mage::getModel('core/session')->setHasAdditionalDescription(false); 
?> 

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?> 

<div id="category_top_image"<?php if ($_category->getCanShowBlock()): ?> style="margin-left: -280px;"<?php endif ?>> 

<?php if($_imgUrl): ?> 
    <?php echo $_imgHtml ?> 
<?php endif; ?> 

<?php if(strtolower($_category->getHideTitle()) != 'yes'): ?> 
<h1><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1> 
<?php endif ?> 

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?> 
    <div class="category-description std"> 
     <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?> 
    </div> 
<?php endif; ?> 

</div> 

<?php if($this->isContentMode()): ?> 
    <?php echo $this->getCmsBlockHtml() ?> 

<?php elseif($this->isMixedMode()): ?> 
    <?php echo $this->getCmsBlockHtml() ?> 
     <?php if($_description=$this->getCurrentCategory()->getAdditionalDescription()): ?> 
      <?php Mage::getModel('core/session')->setHasAdditionalDescription(true) ?> 
<div class="category-additional-description std"> 
      <?php echo $_helper->categoryAttribute($_category, $_description, 'additional_description') ?> 
</div> 
     <?php endif; ?>  
    <?php echo $this->getProductListHtml() ?> 

<?php else: ?> 
    <?php if($_description=$this->getCurrentCategory()->getAdditionalDescription()): ?> 
      <?php Mage::getModel('core/session')->setHasAdditionalDescription(true) ?> 
<div class="category-additional-description std"> 
     <?php echo $_helper->categoryAttribute($_category, $_description, 'additional_description') ?> 
</div> 
    <?php endif; ?> 
    <?php echo $this->getProductListHtml() ?> 
<?php endif; ?> 
+0

是在類別哪個錯誤發生了錨點? – blmage

回答

2

嗯,這錯誤意味着沒有命名catalog.leftnav頁面上的塊,所以你應該檢查你的佈局。實際上,這種檢查類的方法是不好的,因爲它會導致這樣的錯誤。如果某些擴展會重寫Mage_Catalog_Block_Navigation類,也會有問題。

所以我不知道你爲什麼要檢查的類塊的,但如果你真的需要它,我會建議一些風險小,改寫友好:

if ($block = $this->getLayout()->getBlock('catalog.leftnav') && $block instanceof Mage_Catalog_Block_Navigation) { 
    ... 
} 
+0

謝謝..這個幫助。 – nero

相關問題