<?php
/*			AJAX Cart for osConcert	*/
/*	2011 by Martin Zeitler, Germany	*/
/*									*/

defined('_FEXEC') or die();
	if(!defined('BOX_HEADING_SHOPPING_CART'))
	{
	define('BOX_HEADING_SHOPPING_CART', 'Shopping Cart');
	}
	if(!defined('FLAT_CART_CONTENTS'))
	{
	define('FLAT_CART_CONTENTS', 'true');
	}
	//define('PLEASE_LOGIN', 'Please login to select seats');
	/* when login is enforced but not active ... */
	if(SEATPLAN_LOGIN_ENFORCED=='true' && !$FSESSION->is_registered('customer_id'))
	{
	echo '<div style="margin-right: auto; margin-left: auto"><span><a href="' . tep_href_link(FILENAME_LOGIN) . '" class="btn btn-info btn-lg ">' . PLEASE_LOGIN . '</a></span></div>';
	}
	else 
	{
	//require_once 'includes/classes/ajax_cart.php';
	require_once(DIR_WS_CLASSES . 'ajax_cart.php');
	$ajaxCart = new ajaxCart;
	?>
	<?php // start of floating cart
	// next line allows float only on show pages - you can add in others like product_info if needed
	// used really to exclude the checkout pages etc etc
	if(isset($cPath) && $cPath >0)
	{ 
	?>

		<?php 
	}
			//end of roving cart section 
			
			
			// add class 'fixed-cart' to <div> below
			if(!isset($_SESSION[‘mobile’]))
			{
			require_once 'includes/classes/mobile_detect.php';
			$detect = new Mobile_Detect;
						if ( $detect->isMobile())
						{
							$fixedCart="";
						}else
						{
							$fixedCart="fixed-cart";
						}
			} //end
			$showCart='true';
		?>
			
			<div class="card box-shadow <?php echo $fixedCart; ?>">
			<div class="card-header">
			<?php 
			echo '<strong>';
			echo BOX_HEADING_SHOPPING_CART; 
			echo '</strong>';
			?>
			<span id="cart-hide" class="hidden">[-]</span>
			</div>
           <?php //cartzone add something to alert customers of discounts
				if ($cart->count_contents() > 0) 
				{
				if(!defined('DISCOUNT_LINK'))define('DISCOUNT_LINK', '<div class=\'discount_link\'>Click the seat number link below for discount options</div>');
				$sql="SELECT * FROM " . TABLE_SALEMAKER_SALES . " WHERE sale_status=1";
				$sql_result=tep_db_query($sql);
				$num_rows = tep_db_num_rows($sql_result);
				}
				if ($num_rows>0) 
				{
				$ss = DISCOUNT_LINK;
				} else 
				{
				$ss = "";
				}
				echo $ss;
			?>
			<div id="ajax_status"></div>
			<?php
				echo $ajaxCart->getCart('html');
			?>
            
            	<?php //box office refund
				if($_SESSION['customer_country_id']==999 && isset($_SESSION['box_office_refund'] ))
				{	?>
					<script type="text/javascript">
							<!--
							function confirmation() {
								var answer = confirm("<?php echo BO_REFUND; ?>")
								if (answer){
									return true
								}
								else{
									return false
								}
							}
							//-->
							</script>
					<div id="btnCheckOut">
					<?php 
					echo '<a onclick="return confirmation()" title="' . IMAGE_BUTTON_REFUND . '" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_template_image_button('', IMAGE_BUTTON_REFUND) . '</a>'; 
					?>
					</div>
					<?php 	
				}//bor - cancelled due to inability to handle multiple orders
				elseif($_SESSION['customer_country_id']==999 && isset($_SESSION['box_office_reservation'] ))
				{
					?>
				
					<?php 
				}//////////////////////////////////////////////////////////////////////
				else
		{
			?>
			
				<?php 
				//<!--optional account button-->
				//if(!isset($_COOKIE['customer_is_guest'])) 
				//{ 
				//<!--<div class="list-group">
					// if (!$FSESSION->is_registered('customer_id')) 
					// {
					// $button=IMAGE_BUTTON_LOGIN;
					// }
					// else
					// {
					// $button=IMAGE_BUTTON_ACCOUNT;
					// }
					// echo '<a title="' . $button . '" href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . tep_template_image_button('', $button) . '</a>'; 
				//</div>-->
				//}
				//<!--eof optional account button-->
			?>
			
			<div id="btnCheckOut" style="margin: 4px;">
			<?php echo '<a class="pull-right" title="' . IMAGE_BUTTON_CHECKOUT . '" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_template_image_button('', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?>
			</div>
			
			<?php 
		} 
		?>
		</div>
		<br class="clearfloat">

	<?php
	}
	?>