On December 8, I first received this error on a site I manage:

[08-Dec-2016 13:38:28 America/Detroit] PHP Fatal error:  Call to a member function get() on a non-object in /path/to/site/templates/theme/html/com_k2/templates/product/category.php on line 45

Here is the contents of that file around line 45:

<!-- Start K2 Category Layout -->
<div class="container-fluid">
<div id="k2Container" class="span9 productView <?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
    <?php if($this->params->get('show_page_title')): ?>
    <!-- Page title -->
    <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div>
    <?php endif; ?>
    <?php if(isset($this->category) || ( $this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories) )): ?>
    <!-- Blocks for current category and subcategories -->
    <?php foreach($this->secondary as $key => &$item) ?>
    <div class="item_header">
        <?php if($this->params->get('catTitle')): ?>
        <!-- Category title -->
        <h1><?php echo $this->category->name; ?><!-- <span>(<?php echo $item->params->get('page_title'); ?> Collection)</span>-->
            <?php if($this->params->get('catTitleItemCounter')) echo ' ('.$this->pagination->total.')'; ?>
        <?php endif; ?>
    <div class="clr"></div>
    <?php endif; ?>

Line 45 is the <h1> tag.

I have only received this error 5 other times and the last was on December 17. What could be causing this issue? The only thing I can think of that changed is the Joomla! 3.6.5 update!

  • 1
    Try changing $item->params->get() to $this->params->get()
    – Lodder
    Dec 28 '16 at 17:56
  • DOH! Thanks, @Lodder! I have changed that reference and will let you know if that solves the issue (I'm guessing it does). Dec 28 '16 at 18:05
  • @MichaelYaeger is this question resolved?
    – mickmackusa
    Oct 20 '18 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.