Unhandled Error!

Argument 1 passed to ShopPrimaryCategory::getPrimaryBreadcrumbs() must be an instance of Shop_Product, null given, called in /var/www/vhosts/linemarkerpaint.co.uk/httpdocs/modules/cms/classes/cms_controller.php(383) : eval()'d code on line 23 and defined

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

Code Highlight

<?php
class ShopPrimaryCategory
{
    public static function getPrimaryBreadcrumbs(Shop_Product $product)
    {
        if (!$product->category_list) {
           return false;
        }
 
        $primaryBreadcrumbs = array();
 
        $productCategory = $product->category_list[0];
        if ($primaryCategory = $product->primary_category) {
# Call Stack Code Document Line
13 ShopPrimaryCategory::getPrimaryBreadcrumbs(null) /modules/cms/classes/cms_controller.php(383) : eval()'d code 23
12 eval(()) /modules/cms/classes/cms_controller.php 383
11 Cms_Controller->evalWithException('?><meta name="description" content="<?php echo $this->page->description; ?>"> <meta name="keywords" content="<?php echo $this->page->keywords; ?>"> <title><?php echo $this->page->title; ?></title> </head> <body class="page-<?php echo $this->page->id; ?>"> <?php $this->render_partial('tag_manager_no_script'); ?> <? $this->render_partial('global_header') ?> <div class="page-wrapper"> <div class="page-container"> <nav class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"> <ul class="items"> <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a href="<?php echo root_url('/'); ?>" itemprop="item"><span itemprop="name">Home</span><meta itemprop="position" content="1" /></a> </li> <?php $pos=2; if ($primaryBreadcrumbs = ShopPrimaryCategory::getPrimaryBreadcrumbs($product)) : ?> <? foreach ($primaryBreadcrumbs as $breadcrumb): ?> <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="<?= $breadcrumb->page_url('/category') ?>/" title="<?= $breadcrumb->name ?>" itemprop="item"><span itemprop="name"><?= $breadcrumb->name ?></span><meta itemprop="position" content="<?php echo $pos; ?>" /></a></li> <? $pos++; endforeach ?> <?php endif; ?> <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a href="<?php echo $product->page_url('/product'); ?>/" itemprop="item"><span itemprop="name"><?php echo $product->name; ?></span><meta itemprop="position" content="<?php echo $pos; ?>" /></a> </li> </ul> </nav> <div class="page-main"> <div class="row"> <div class="col-md-12"> <section id="product" class="product"> <? $this->render_partial('banner_modal') ?><br/> <?php $this->render_partial('shop:product', array( 'product' => $product )); ?> </section> <section class="offer"><br/> <?php $this->render_partial('shop:offerbox'); ?> </section> <?php $this->render_partial('shop:product:tabs'); ?> <?php $this->render_partial('shop:automatic_related_products'); ?> <div id="addToBasket" class="b-modal modal fade" id="addToBasket" tabindex="-1" role="dialog" aria-labelledby="addToBasket" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5>Your product has been added to the basket</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <div class="row"> <div class="col-md-4"> <img src="<?php echo $product->image_url(0, 320, 240); ?>" alt="" /> </div> <div class="col-md-8"> <h5><?php echo $product->name; ?></h5> <br> <div class="product-rating stars-<?php echo $product->rating_approved; ?>"> <a href="<?php echo $product->page_url('/product'); ?>/#reviews"><?php echo !empty($product->rating_review_num) ? "{$product->rating_review_num} review(s)" : "0 review(s)"; ?></a> </div> <p><?php echo $product->short_description; ?></p> </div> </div> <div class="row"> <div class="col-md-6 order-2 order-md-1"> <br> <a href="#" data-dismiss="modal" class="btn btn-inverse" aria-label="Close">&larr; Continue shopping</a> </div> <div class="col-md-6 order-1 order-md-2"> <br> <a class="btn" href="<?php echo root_url('/cart/'); ?>">View my basket</a> </div> </div> </div> </div> </div> </div> </div> </div> </div> <script> dataLayer.push({ 'event' : 'view_item', 'ecommerce' : { 'items': [{ 'item_id': '<?php echo $product->sku; ?>', 'item_name': '<?php echo $product->name ?>', 'price': '<?php if($product->om('is_on_sale')): ?><?php echo $product->om('sale_price'); ?><?php else: ?><?php echo $product->om('price') ?><?php endif; ?>' }] } }); </script> <?php $this->render_partial('boblite_checkout_hook');?> </div> </div> <?php $this->render_partial('global_footer'); ?>', 'CMS page', 'Product') /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 => 'spectrum-thermamark-r117-electric-car-logo-side-100cm']) /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('/product/spectrum-thermamark-r117-electric-car-logo-side-100cm') /phproad/system/phproad.php 31
2 include('/var/www/vhosts/linemarkerpaint.co.uk/httpdocs/phproad/system/phproad.php') /boot.php 114
1 require_once('/var/www/vhosts/linemarkerpaint.co.uk/httpdocs/boot.php') /index.php 3