<?php
/**
 * Showing the page
 */

//Defining the template
$template	= new Template( $page );

//Defining the meta
$meta		= ( defined( 'METADATA_PRODUTO' ) ) ? METADATA_PRODUTO : null;

//Including the template's variables
require( BASE_DIR . '/include/variables.php' );

//Products
try{

	//Defining
	$object					= SearchController::bySlug( 'product', $page->slug );

	//Defining the object to template
	$template->OBJ_PRODUCT	= $object;

	//Defining
	$records				= ListController::notActiveByCategoryOrderly( 'product', $object->id, $object->category->id );

	//Checking
	if( !is_null( $records ) )
		//Listing
		foreach( $records as $record ){

			//Defining
			$template->OBJ_OTHER_PRODUCT	= $record;

			//Showing
			$template->block( 'OTHER_PRODUCT' );

		}

}catch( Exception $e ){

	//Redirecting
	header( 'Location:' . BASE_URL );

}

//Defining some variables
$template->BASE_URL_REPOSITORY	= BASE_URL_REPOSITORY;
$template->SOURCE_SITE_INTERNAL	= SOURCE_SITE_INTERNAL;

//Showing the page
$template->show();