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 21 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 21
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="container--lg"> <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)) : ?> <? $i=1; 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> <?php if ($i < count($primaryBreadcrumbs)): ?> <span class="breadcrumb-hover"> <span> <?php if ($breadcrumb->list_children('front_end_sort_order')->count): ?> <div class="breadcrumb-category"> <?php foreach ($breadcrumb->list_children('front_end_sort_order') as $subcategory): ?> <a href="<?= $subcategory->page_url('/category') ?>/" title="<?= h($subcategory->name) ?>" data-gtm="Breadcrumb Pop (P)"><?= h($subcategory->name) ?></a> <?php endforeach; ?> </div> <?php endif; ?> </span> </span> <?php else: ?> <?php if ($breadcrumb->eval_num_of_products()): ?> <span class="breadcrumb-hover"> <span> <div class="breadcrumb-category"> <p style="margin-bottom: 9px; margin-top: 0;"><strong>Top Products</strong></p> <?php $products = $breadcrumb->list_products(array('sorting'=>array('price desc')))->limit(3)->find_all(); ?> <?php foreach ($products as $breadcrumbProduct): ?> <a href="<?php echo $breadcrumbProduct->page_url('/product'); ?>/" data-gtm="Breadcrumb Pop (P)"><?php echo $breadcrumbProduct->name; ?></a> <?php endforeach; ?> <a href="<?= $breadcrumb->page_url('/category') ?>/">View All</a> </div> </span> </span> <?php endif; ?> <?php endif; ?> </li> <? $i++; $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> <section style="background-color: var(--grey-light); padding-top: 35px; padding-bottom: 25px;"> <div class="container--lg"> <section id="product" class="product"> <? //$this->render_partial('banner_modal') ?> <?php $this->render_partial('shop:product', array( 'product' => $product )); ?> </section> </div> </section> <section style="background-color: var(--grey-light);"> <div class="container"> <div class="product-payment-icons product-payment-icons-mobile"> <img src="/img/payment-icons-colour.webp" alt="Payment by Visa, Master Card, PayPal Pay in 3, Pay By Bank, BACS" loading="lazy" width="254" height="33" /> </div> <?php if ($product->calculator): ?> <div class="calculator-cta calculator-cta-mobile"> <a href="/line-marking-paint-calculator"> <img src="/img/LMP-paint-calculator-banner.webp" alt="Home much will I need? Use our handy calculator" width="800" height="149" loading="lazy" /> </a> </div> <?php endif; ?> </div> </section> <?php //$this->render_partial('shop:offerbox'); ?> <section style="background-color: var(--grey-light); padding-top: 1px; padding-bottom: 25px;"> <div class="container--lg"> <?php $this->render_partial('shop:product:tabs'); ?> </div> </section> <section style="background-color: var(--grey-light); padding-top: 5px; padding-bottom: 25px;"> <div class="container"> <div class="title"> <h2>Related Products</h2> </div> </div> <div class="container--md"> <?php $this->render_partial('shop:automatic_related_products'); ?> </div> </section> <section style="padding-top: 30px; padding-bottom: 40px;"> <div class="container"> <?php $this->render_partial('community'); ?> </div> </section> <section style="background-color: var(--grey-light); padding-top: 40px; padding-bottom: 40px;"> <div class="container"> <?php $this->render_partial('blog_latest'); ?> </div> </section> <section style="padding: 22px 0;"> <div class="container"> <?php $this->render_partial('brands'); ?> </div> </section> <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> ', '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 => 'check-valve-50psi']) /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/check-valve-50psi') /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