Unhandled Error!

Argument 1 passed to ShopCategoryLayout::getLayout() must be an instance of Shop_Category, null given, called in /var/www/vhosts/nationalheatershops.co.uk/httpdocs/modules/cms/classes/cms_controller.php(383) : eval()'d code on line 2 and defined

Document /modules/shopcategorylayout/classes/shopcategorylayout.php
Document type PHP document
Line 4
Exception class Phpr_PhpException

Code Highlight

<?php
class ShopCategoryLayout
{
    public static function getLayout(Shop_Category $category)
    {
        unset( $_SESSION['layout']);
        $layout = 'grid';
        $mobileLayout = 'grid';
 
        if (!$category->layout || $category->layout == 'default') {
            if ($configLayout = Phpr::$config->get('DEFAULT_CAT_LAYOUT')) {
                $layout = $configLayout;
            }
# Call Stack Code Document Line
13 ShopCategoryLayout::getLayout(null) /modules/cms/classes/cms_controller.php(383) : eval()'d code 2
12 eval(()) /modules/cms/classes/cms_controller.php 383
11 Cms_Controller->evalWithException('?><?php $layout = ShopCategoryLayout::getLayout($category); $showFilters = true; ?> <section class="content"> <section class="category <?php echo $category->url_name; ?>"> <div id="category-page"> <? if ($category): $subcategories = $category->list_children('front_end_sort_order'); $has_subcategories = $subcategories->count; $has_products = $category->eval_num_of_products(); ?> <section class="<? if (!$has_subcategories && $has_products): ?>l-theme3<?php endif; ?>"> <div class="container--md"> <div class="cat-heading"> <h1><?= $category->name ?></h1> <? if (!$has_subcategories && $has_products): ?> <p class="description"><?= ($category->short_description) ?></p> <p class="cat-read-more"><a href="#category-footer-description" onclick="scrollToDescription();">Read More</a></p> <script> function scrollToDescription() { openTab('category-tab-1'); document.getElementById("category-footer-description").scrollIntoView(); } </script> <?php endif; ?> </div> </div> </section> <? if ($has_subcategories): ?> <?php if($category->images->count >= 1): ?> <section class="<? if (!$has_subcategories && $has_products): ?>l-theme3<?php endif; ?>"> <div class="container--md"> <div class="product-images-top"> <?php $image = $category->images; ?> <img src="<?= $image[1]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> </div> </section> <? endif ?> <div class="container--md"> <div class="c-category-description"> <?= $category->description ?> </div> </div> <div class="container"> <div class="c-categories"> <? foreach ($subcategories as $subcategory): ?> <div class="c-categories__item"> <a href="<?= rtrim($subcategory->page_url('c'), '/') ?>/" title="<?= h($subcategory->name) ?>" class="c-categories__item-img"> <img class="primary" src="<?= $subcategory->image_url(0, 320, 'auto'); ?>" title="<?= h($subcategory->name) ?>" alt="<?= h($subcategory->images->title) ?>" loading="lazy" /> <h3><?= h($subcategory->name) ?></h3> </a> </div> <? endforeach ?> </div> </div> <div class="container--md"> <p class="description"><?= ($category->short_description) ?></p><br/> <?php if($category->images->count >= 3): ?> <div class="product-images"> <?php $image = $category->images; ?> <img src="<?= $image[2]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> <div class="product-images"> <img src="<?= $image[3]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> <? endif ?> </div> <? endif ?> <? if ($has_products): ?> <?php if($category->images->count >= 2): ?> <section class="l-theme3"> <div class="product-images-top"> <?php $image = $category->images; ?> <img src="<?= $image[1]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> </section> <? endif ?> <? if ($has_subcategories): ?> <? if ($category->short_description): ?> <p class="description"><?= h($category->short_description) ?></p> <?= $category->description ?> <? endif ?> <hr /> <h2 class="hide-for-small">Popular Products</h2> <div class="c-category-product-list"> <?php $this->render_partial('shop:product_list:2:0', array( 'products' => $category->list_products(array('sorting'=>array('price'))), 'class' => 'two mobile-two', 'records_per_page' => 6, 'paginate'=> true, 'pagination_base_url' => $category->page_url('/c'), 'page_index' => $this->request_param(-1, 0) )); ?> </div> <? endif ?> <? endif ?> <? if (!$has_subcategories && !$has_products): ?> <p>This category does not contain any products or subcategories.</p> <p><a href="<?= root_url('/')?>" title="Return to the home page">Return to the home page</a></p> <? endif ?> <? else: ?> <h1>Category not found</h1> <p>Sorry, the specified category cannot be found.</p> <p><a href="<?= root_url('/')?>" title="Return to the home page">Return to the home page</a></p> <? endif ?> </div> </section> </section> <? if (!$has_subcategories && $has_products): ?> <section class="l-theme3"> <div class="container"> <div class="c-category-product-cols"> <?php if($layout != 'grid'): ?> <div class="c-category-product-left"> <?php $this->render_partial('need_help'); ?> </div> <?php endif; ?> <div class="c-category-product-right"> <div class="c-breadcrumbs"> <span><a href="/">Home</a></span> <? if ($category): ?> <? foreach ($category->get_parents() as $parent): ?> <span> &gt; <a href="<?= $parent->page_url('/c') ?>/"><?= h($parent->name) ?></a></span> <? endforeach ?> <?php endif; ?> <span> &gt; <?php echo $category->name; ?></span> </div> <div class="container"> <div class="c-cat-tool-bar"> <a href="?layout=grid" class="btn-grid<?php if($layout == 'grid'): ?> active<?php endif; ?>"></a> <a href="?layout=list" class="btn-list<?php if($layout != 'grid'): ?> active<?php endif; ?>"></a> </div> </div> <div class="c-category-product-list list-<?php echo $layout; ?>"> <?php $this->render_partial('shop:product_list:2:0', array( 'products' => $category->list_products(array('sorting'=>array('price desc'))), 'class' => 'two mobile-two', 'records_per_page' => 120, 'paginate'=> true, 'pagination_base_url' => $category->page_url('/c'), 'page_index' => $this->request_param(-1, 0) )); ?> </div> </div> </div> </div> </section> <section id="category-footer-description" class="category-footer-description"> <div class="category-tabs"> <div role="tablist" aria-label="Category Information Tabs" class="category-tabs__buttons"> <button role="tab" type="button" onclick="openTab('category-tab-1')" aria-selected="false" aria-controls="category-tab-1" id="category-tab-1-button" class="btn category-tab-button" tabindex="1"> Description </button> </div> <div class="category-tabs__content"> <h2 class="category-tabs__heading" id="mobile-category-tab-1" onclick="openTab('category-tab-1')">Description</h2> <div tabindex="1" role="tabpanel" id="category-tab-1" class="category-tab active" aria-labelledby="Description tab"> <div class="container"> <p class="description"><?= ($category->description) ?></p> </div> </div> </div> </div> </section> <?php if($layout == 'grid'): ?> <?php $this->render_partial('need_help'); ?> <?php endif; ?> <section class="category-page-lower category <?php echo $category->url_name; ?>"> <div class="container--md"> <?php if($category->images->count >= 3): ?> <div class="product-images"> <?php $image = $category->images; ?> <img src="<?= $image[2]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> <div class="product-images"> <img src="<?= $image[3]->getThumbnailPath('auto', 'auto') ?>" loading="lazy" /> </div> <? endif ?> </div> </section> <? endif ?> <script> function openTab(tabName) { mobileTabs = (window.innerWidth < 800) ? true : false; var i; var x = document.getElementsByClassName("category-tab"); for (i = 0; i < x.length; i++) { if (!mobileTabs) { x[i].classList.remove('active'); } } var tabContent = document.getElementById(tabName); if (!mobileTabs) { tabContent.classList.add('active'); var tabButtons = document.getElementsByClassName('category-tab-button') for (i = 0; i < tabButtons.length; i++) { tabButtons[i].classList.remove('active'); } var button = document.getElementById(tabName + '-button'); button.classList.add('active'); } else { var button = document.getElementById('mobile-' + tabName); button.classList.toggle("active"); tabContent.classList.toggle("mobile-active"); } } </script>', 'CMS page', 'Brand') /modules/cms/classes/cms_controller.php 608
10 Cms_Controller->eval_page_content(()) /modules/cms/classes/cms_controller.php 198
9 Cms_Controller->open(object(Cms_Page), array(1) [0 => 'alorair']) /controllers/application.php 72
8 Application->On404(())
7 call_user_func_array(array(2) [0 => object(Application), 1 => 'On404'], array(0)) /phproad/modules/phpr/classes/phpr_controller.php 170
6 Phpr_Controller->executeAction('On404', array(0)) /phproad/modules/phpr/classes/phpr_controller.php 84
5 Phpr_Controller->_run('On404', array(0)) /phproad/modules/phpr/classes/phpr_response.php 64
4 Phpr_Response->open404(()) /phproad/modules/phpr/classes/phpr_response.php 37
3 Phpr_Response->open('/brand/alorair') /phproad/system/phproad.php 31
2 include('/var/www/vhosts/nationalheatershops.co.uk/httpdocs/phproad/system/phproad.php') /boot.php 114
1 require_once('/var/www/vhosts/nationalheatershops.co.uk/httpdocs/boot.php') /index.php 3