Unhandled Error!

Trying to get property of non-object

Document /modules/templateidgas/classes/templateidgas_module.php
Document type PHP document
Line 47
Exception class Phpr_PhpException

Code Highlight

				$is511 = false;
				if(count($params) > 1){
					if($params[0] == 'product'){					
						//Get Product Category
						$product = Shop_Product::create()->find_by_url_name($params[1]);
						//var_dump($product);
						foreach($product->category_list as $category)
						{
							$parents = $category->get_parents(true);
							//var_dump($parents);
							foreach($parents as $parent){
								if($parent->name == '5.11 Tactical') //check if it is 5.11 category
									$page->template_id = $tid;
# Call Stack Code Document Line
19 TemplateIDGAS_Module->before_route('/product/smk-4x32-scope-including-mounts')
18 call_user_func_array(array(2) [0 => object(TemplateIDGAS_Module), 1 => 'before_route'], array(1) [0 => '/product/smk-4x32-scope-including-mounts']) /phproad/system/class_functions.php 18
17 callFunction(array(2) [0 => object(TemplateIDGAS_Module), 1 => 'before_route'], array(1) [0 => '/product/smk-4x32-scope-including-mounts']) /phproad/modules/phpr/classes/phpr_events.php 76
16 Phpr_Events->fire_event(array(1) [name => 'cms:onBeforeRoute'], '/product/smk-4x32-scope-including-mounts')
15 call_user_func_array(array(2) [0 => object(Phpr_Events), 1 => 'fire_event'], array(2) [0 => array(1), 1 => '/product/smk-4x32-scope-including-mounts']) /phproad/system/class_functions.php 18
14 callFunction(array(2) [0 => object(Phpr_Events), 1 => 'fire_event'], array(2) [0 => array(1), 1 => '/product/smk-4x32-scope-including-mounts']) /phproad/modules/phpr/classes/phpr_events.php 116
13 Phpr_Events->fireEvent('cms:onBeforeRoute', '/product/smk-4x32-scope-including-mounts')
12 call_user_func_array(array(2) [0 => object(Phpr_Events), 1 => 'fireEvent'], array(2) [0 => 'cms:onBeforeRoute', 1 => '/product/smk-4x32-scope-including-mounts']) /phproad/modules/phpr/classes/phpr_extensible.php 159
11 Phpr_Extensible->__call('fireEvent', array(2) [0 => 'cms:onBeforeRoute', 1 => '/product/smk-4x32-scope-including-mounts']) /controllers/application.php 24
10 Backend_Events->fireEvent('cms:onBeforeRoute', '/product/smk-4x32-scope-including-mounts') /controllers/application.php 24
9 Application->resolve_page(null) /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 161
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 79
4 Phpr_Response->open404(()) /phproad/modules/phpr/classes/phpr_response.php 52
3 Phpr_Response->open('/product/smk-4x32-scope-including-mounts') /phproad/system/phproad.php 31
2 include('/usr/www/users/genuik/newsurplus/phproad/system/phproad.php') /boot.php 107
1 require_once('/usr/www/users/genuik/newsurplus/boot.php') /index.php 3