Unhandled Error!

Trying to get property of non-object

Document Product
Document type CMS page
Line 3
Exception class Cms_ExecutionException

Code Highlight

<?php
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
    Phpr::$response->redirect('/shop/cupcakes/#/'.$product->url_name);
    exit;
}
?>
<div id="product_page">
	<? if ($product_unavailable): ?>
		<h2>We are sorry, product unavailable.</h2>
	<? elseif(!$product): ?>
		<h2>We are sorry, product not found.</h2>
	<? else: ?>
		<? $this->render_partial('product_partial') ?>
# Document Type
1 Product CMS page