<?php
/*
  osCommerce, Open Source E-Commerce Solutions 
http://www.oscommerce.com 

Copyright (c) 2003 osCommerce 

osCommRes, Services Oline 
http://www.oscommres.com 
Copyright (c) 2005 osCommRes 

Freeway eCommerce 
http://www.zac-ware.com/freeway 
Copyright (c) 2007 ZacWare 

Released under the GNU General Public License
*/
// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
?>
<!-- shopping_cart //-->
<tr>
	<td>
<?php
	$replace_array=array();
	$template_html='<tr>
						<td width="{{INITIAL_WIDTH}}"></td><td class="{{CLASS}}">{{SPACER}}{{ICON}}</td><td class="{{CLASS}}" align=right>{{QUAN}}&nbsp;x&nbsp;</td><td valign="top" class="{{CLASS}}"><a href={{LINK_1}}> {{NAME}}</a></td>
					</tr>
					<tr>
						<td height="5"></td>
					</tr>
					';
					
	if(!defined('BOX_HEADING_SHOPPING_CART'))define('BOX_HEADING_SHOPPING_CART', 'Shopping Cart');
	$info_box_contents = array();
	$info_box_contents[] = array('text'  =>BOX_HEADING_SHOPPING_CART);

	//new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));

	new infoBoxHeading($info_box_contents, true, true);
	$cart_contents_string = '';
	if ($cart->count_contents() > 0) {
		$products = $cart->get_products();
		for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			$replace_string=$template_html;
			if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
				$replace_array["CLASS"] = 'infoBoxNavigationSelect';
			} else {
				$replace_array["CLASS"] = 'infoBoxNavigation';
			}
			$replace_array["INITIAL_WIDTH"]=$INITIAL_WIDTH;
			$replace_array["SPACER"]=tep_draw_separator('pixel_trans.gif',10,1);
			$replace_array["ICON"]=$BOX_CONTENT_ICON;
			$replace_array["QUAN"]=$products[$i]['quantity'];
			$replace_array["LINK_1"]=tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']);
			$replace_array["NAME"]=$products[$i]['name'];
			
			reset($replace_array);
			while(list($key,)=each($replace_array)){
				$replace_string=str_replace("{{" . $key . "}}",$replace_array[$key],$replace_string);
			}
			$cart_contents_string.=$replace_string;
			if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
				tep_session_unregister('new_products_id_in_cart');
			}
		}
	} else {
		$cart_contents_string .= '<tr><Td>'.tep_draw_separator('pixel_trans.gif',15,1).'<td><td class="infoBoxNavigation">'.BOX_SHOPPING_CART_EMPTY.'</td></tr>';
	}

	$info_box_contents = array();
	$info_box_contents[] = array('text' =>  '<table cellpadding="0" cellspacing="0"><tr><td class="productSpecialPrice">' . $cart_contents_string . '</td></tr></table>');

	if ($cart->count_contents() > 0) {
		// WebMakers.com Added: Shoppe Enhancement Controller
		// check for free order
		$final_total=$cart->show_total();
		if ($final_total==0) {
		  $final_total='Free';
		} else {
		  $final_total=$currencies->format($cart->show_total());
		}
		$info_box_contents[] = array('text' => tep_draw_separator());
		$info_box_contents[] = array('align' => 'right',
									 'text' => '<table cellpadding="2" cellspacing="2"><tr><td class="main" align="right">' . $final_total . '</td></tr></table>');
	}
	// ICW ADDED FOR CREDIT CLASS GV
	if (tep_session_is_registered('customer_id')) {
	$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
	$gv_result = tep_db_fetch_array($gv_query);
		if ($gv_result['amount'] > 0 ) {
			$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
			$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>');
			$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>');
		}
	}
	if (tep_session_is_registered('gv_id')) {
		$gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
		$coupon = tep_db_fetch_array($gv_query);
		$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
		$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>');
	}
	if (tep_session_is_registered('cc_id') && $cc_id) {
		$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
		$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . CART_COUPON . '</td><td class="smalltext" align="right" valign="bottom">' . '<a href="javascript:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>' . '</td></tr></table>');
	}

	// start shopping cart change
	if (defined("ALLOW_GUEST_TO_SEE_PRICES")){
	  if (ALLOW_GUEST_TO_SEE_PRICES=='true' && !tep_session_is_registered('customer_id')) {
		  $box_text = $currencies->format($cart->show_total());
	  } else if (tep_session_is_registered('customer_id')) {
		  $box_text = $currencies->format($cart->show_total());
	  } else {
		  $box_text = PRICES_LOGGED_IN_TEXT;
	  }
	} else {
	  $box_text = $currencies->format($cart->show_total());
	}

	if ($cart->count_contents() > 0) {
		$info_box_contents[] = array('align' => 'right',
								 'text' => '<table cellpadding="2" cellspacing="2"><tr><td class="main" align="right"><b>' . $box_text . '</b></td></tr></table>');
	}

	// ADDED FOR CREDIT CLASS GV END ADDITTION
	new infoBox($info_box_contents);
	
	$info_box_contents = array();
	$info_box_contents[] = array('align' => 'left',
								'text'  => tep_draw_separator('pixel_trans.gif', '100%', '1')
							  );
	new infoboxFooter($info_box_contents, true, true);
?>
	</td>
</tr>
<!-- shopping_cart_eof //-->