简体   繁体   中英

Magento: Fatal error: Call to a member function getItems() on a non-object

We are currently using ManaFilters extension for magento, however we are currently experincing some difficulties with it no being functional.

This is the error message it products:

Fatal error: Call to a member function getItems() on a non-object in /var/www/app/code/local/Mana/Filters/Model/Filter/Category.php on line 171

Here is the code associated with line 171:

/**
 * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection $categories
 * @return Mana_Filters_Model_Filter_Category
 */
public function addCountToCategories($categories, $products = null) {
    if (!$products) {
        $products = $this->getLayer()->getProductCollection();
    }
    $products->addCountToCategories($categories);
     if (($items = $categories->getItems()) && count($items)) {
        $category = array_shift($items);
        if (!$category->hasProductCount()) {
            Mage::helper('mana_filters')->addCountToCategories($products, $categories);
        }
    }
    return $this;
}

}

Any help would be appreciated.

Based on your description, $ categories is equal to null when $items = $categories->getItems() is about to be executed. Limited by the context you give out, maybe $ categories is alreay null in somewhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM