<?php 
defined('_FEXEC') or die();
if(!defined('FLAT_CART_CONTENTS'))
{
define('FLAT_CART_CONTENTS', 'none');
}
define('MODULE_NAVBAR_SHOPPING_CART_TITLE', 'Shopping Cart');
define('MODULE_NAVBAR_SHOPPING_CART_DESCRIPTION', 'Show Shopping Cart in Navbar');

if($i>1)
{
	$item =ITEMS;
}
else
{
	$item =ITEMS;
}

//define('MODULE_NAVBAR_SHOPPING_CART_CONTENTS', '<i title="Shopping Cart" class="fa fa-shopping-cart fa-fw"></i><span id="total_head_seats" class="d-inline d-sm-none d-md-inline"> %1$s ' . (($i==1)? '' . ITEM . '': $i . ' ' . ITEMS . '') . '</span> <span class="caret"></span>');

define('MODULE_NAVBAR_SHOPPING_CART_CONTENTS', '<i title="Shopping Cart" class="fa fa-shopping-cart fa-fw"></i><span id="total_head_seats" class="d-inline d-sm-none d-md-inline"> %1$s ' . $item . '</span> <span class="caret"></span>');
define('MODULE_NAVBAR_SHOPPING_CART_NO_CONTENTS', '<i class="fa fa-shopping-cart fa-fw"></i> 0 ' . ITEMS . '');
define('MODULE_NAVBAR_SHOPPING_CART_HAS_CONTENTS', '<span id="total_seats">%s ' . ITEMS . ' %s</span>');
//define('MODULE_NAVBAR_SHOPPING_CART_VIEW_CART', HEADER_VIEW_CART);
define('MODULE_NAVBAR_SHOPPING_CART_CHECKOUT', '<i class="fa fa-angle-right fa-fw"></i> ' . HEADER_TITLE_CHECKOUT . '');
define('MODULE_NAVBAR_SHOPPING_CART_PRODUCT', '<div class="indiv_ticket ticket_id_%s"><a class="dropdown-item" href="' . tep_href_link('product_info.php', 'products_id=%s') . '">
  <span class= "cnt">%s</span> x <span class="pn">%s</span><span class="pp" style="display:none">%s</span></a></div>');

?>

		<li class="nav-item dropdown">
		<a class="nav-link dropdown-toggle" href="#" id="navDropdownCart" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		<?php echo sprintf(MODULE_NAVBAR_SHOPPING_CART_CONTENTS, $cart->count_contents()); ?>
		</a><div id="ajax_status"></div>

		<div class="dropdown-menu" aria-labelledby="navDropdownCart">
		<?php 
		echo '<a class="dropdown-item" href="' . tep_href_link('shopping_cart.php') . '">' . sprintf(MODULE_NAVBAR_SHOPPING_CART_HAS_CONTENTS, $cart->count_contents(), $currencies->format($cart->show_total())) . '</a>';
		
		echo '<div class="dropdown-divider"></div>' . PHP_EOL;    
		echo '<div class="ticket_list">' . PHP_EOL; 
		if ($cart->count_contents() > 0) 
		{
		$products = $cart->get_products();
		foreach ($products as $k => $v) 
		{
		echo sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT,$v['id'], $v['id'],$v['quantity'], $v['name'], $v['final_price']);
		}
		}
		echo '</div>' . PHP_EOL; 
		//echo '<div class="dropdown-divider"></div>' . PHP_EOL;
		echo '<a class="dropdown-item" href="' . tep_href_link('checkout_shipping.php', '', 'SSL') . '">' . MODULE_NAVBAR_SHOPPING_CART_CHECKOUT . '</a>' . PHP_EOL;
		?>
		</div>
		</li>