Unhandled Error!

Trying to get property of non-object

Document /modules/googleanalytics/models/cms_stats_settings.php
Document type PHP document
Line 444
Exception class Phpr_PhpException

Code Highlight

            $product_name = strip_tags($product->title ? $product->title : $product->name);
 
            return "
    ga('ec:addProduct', {
       'id': '{$product->id}',
       'name': '{$product_name}',
       'category': '{$product->categories[0]->name}'
    });
    ga('ec:setAction', 'detail')\n"; 
 
        }
 
        public function ga_add_to_cart($product)
# Call Stack Code Document Line
14 Cms_Stats_Settings->ga_add_product_details_view(object(Shop_Product)) /modules/googleanalytics/classes/shop_actions.php 212
13 Shop_Actions->product(()) /modules/resources/classes/resources_actions.php 87
12 Resources_Actions->product(()) /modules/cms/classes/cms_actionmanager.php 72
11 Cms_ActionManager::execAction('resources:product', object(Cms_Controller)) /modules/cms/classes/cms_controller.php 580
10 Cms_Controller->eval_page_content(()) /modules/cms/classes/cms_controller.php 198
9 Cms_Controller->open(object(Cms_Page), array(1) [0 => 'discount']) /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/discount') /phproad/system/phproad.php 31
2 include('/var/www/vhosts/essentialphoto.co.uk/httpdocs/phproad/system/phproad.php') /boot.php 118
1 require_once('/var/www/vhosts/essentialphoto.co.uk/httpdocs/boot.php') /index.php 3