<?php 

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'event_action=update_cart'));?>

<table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB;?>">
<?php
	//below this condition $products[$i]['subscription_type']!="M" for Hide the Store Membership subscription in front end Shopping cart 

	$type_array=array('B'=>TEXT_SUBSCRIPTION_BASIC,'C'=>TEXT_SUBSCRIPTION_CASUAL,'S'=>TEXT_SUBSCRIPTION_SEASONAL);
	if($customer_id=='') {
		tep_session_register('not_customer');
		$not_customer=true;
	}
	$customers_name=""; 
	$no_attendees=$cart->get_max_attendees(); 
	
	$cart->get_attendees();

	$customers_list=$cart->attendees;
	$no_attendee = $no_attendees;

	for($icnt=0;$icnt<$no_attendees;$icnt++){
		$customer=$customers_list[$icnt];
		$customers_name.=$customer['first_name'].' '.$customer['last_name'].",";
	} 
	$customers_name=$customers_name;
	// BOF: Lango Added for template MOD
   if (SHOW_HEADING_TITLE_ORIGINAL == 'yes') {
	$header_text = '&nbsp;';
	//EOF: Lango Added for template MOD
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cart.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
	}else{
		if(basename($PHP_SELF) == 'shopping_cart.php')
			$header_text =  HEADING_TITLE;
		else
			$header_text =  TEXT_SHOPPING_CART;
	}
	
	if (MAIN_TABLE_BORDER == 'yes'){
		table_image_border_top(false, false, $header_text);
	}
?><br />
<?php
	// changes from(N)
	if ($messageStack->size('shopping_cart') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('shopping_cart'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
	}
?>
<?php
	if ($cart->count_contents() > 0) {

?>
	<tr>
		<td>
<?php
		$info_box_contents = array();
		if(basename($PHP_SELF) == 'shopping_cart.php'){
		if (isset($hide_shopping_header)){
			$info_box_contents[0][] = array('align' => 'center',
											'params' => 'class="productListing-heading"',
											'text' => TABLE_HEADING_REMOVE);
		
			$info_box_contents[0][] = array('params' => 'class="productListing-heading"',
											'text' => TABLE_HEADING_PRODUCTS);
		
			$info_box_contents[0][] = array('align' => 'center',
											'params' => 'class="productListing-heading"', 
											'text' => TABLE_HEADING_QUANTITY); 
		
			$info_box_contents[0][] = array('align' => 'right',
											'params' => 'class="productListing-heading"',
											'text' => TABLE_HEADING_TOTAL . "&nbsp;&nbsp;");
		}
		}
		$any_out_of_stock = 0;
		$products = $cart->get_products();
		
		$switch_continue_shopping = true;	 
		for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			// Push all attributes information in an array
			if($products[$i]['element_type']=='V'){
				$switch_continue_shopping = false;
			}
			if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
				while (list($option, $value) = each($products[$i]['attributes'])) {
					echo tep_draw_hidden_field('id[' . $products[$i]['sh_id'] . '][' . $option . ']', $value);
					if ($products[$i]['element_type']=="V"){
						$attributes = tep_db_query("select vopt.services_options_name as products_options_name, voval.services_options_values_name as products_options_values_name, va.options_values_price as options_values_price, va.price_prefix
												  from " . TABLE_SERVICES_OPTIONS . " vopt, " . TABLE_SERVICES_OPTIONS_VALUES . " voval, " . TABLE_SERVICES_ATTRIBUTES . " va
												  where va.service_id = '" . $products[$i]['id'] . "'
												   and va.options_id = '" . $option . "'
												   and va.options_id = vopt.services_options_id
												   and va.options_values_id = '" . $value . "'
												   and va.options_values_id = voval.services_options_values_id
												   and vopt.language_id = '" . $languages_id . "'
												   and voval.language_id = '" . $languages_id . "'");
												   
					} else {
						$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
							from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
							where pa.products_id = '" . (int)$products[$i]['id'] . "'
							 and pa.options_id = '" . (int)$option . "'
							 and pa.options_id = popt.products_options_id
							 and pa.options_values_id = '" . (int)$value . "'
							 and pa.options_values_id = poval.products_options_values_id
							 and popt.language_id = '" . (int)$languages_id . "'
							 and poval.language_id = '" . (int)$languages_id . "'");
							 
							 
				  }     
				  $attributes_values = tep_db_fetch_array($attributes);
				  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
				  $products[$i][$option]['options_values_id'] = $value;
				  $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
				  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
				  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
				}
			}
		}
    $show_shipping=false; 
		
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (($i/2) == floor($i/2)) {
        $info_box_contents[] = array('params' => 'class="productListing-even" height="25"');
      } else {
        $info_box_contents[] = array('params' => 'class="productListing-odd" height="25"');
      }

      $cur_row = sizeof($info_box_contents) - 1;
     //print_r($products);
	 $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                       '  <tr>';
	   if(basename($PHP_SELF) == 'shopping_cart.php'){ 
		  if ($products[$i]['element_type']=='E'){ 
			  $products_name.='    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_SESSION_DETAILS, 'events_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, '') . '</a></td>' .
						   '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SESSION_DETAILS, 'events_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
		  } else if ($products[$i]['element_type']=='S'){
			  $products_name.='    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_SUBSCRIPTION_INFO, 'subscription_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, '') . '</a></td>' .
						   '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SUBSCRIPTION_INFO, 'subscription_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
						   //' <br>' . TEXT_TYPE . $type_array[$products[$i]["subscription_type"]] . '';
		  }else if ($products[$i]['element_type']=='V'){
				$prid=tep_get_service_prid($products[$i]['id']);
				$products_name.='    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_SERVICES_INFO, 'service_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, '') . '</a></td>' .
				'    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SERVICES_INFO, 'service_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
				$products_id=$products[$i]['id']; 
		  } 
		  else {
		  				 $subs_query=tep_db_query("select sc.subscription_categories_id as cat_id,s.subscription_id as id from " .TABLE_SUBSCRIPTIONS ." s," . TABLE_SUBSCRIPTION_TO_SUBSCRIPTION_CATEGORIES . " sc where s.subscription_id=sc.subscription_id and  s.subscription_type='M' and s.subscription_status='1'");
				$row=tep_db_fetch_array($subs_query);
				$subscription_id=$row['id'];
				if($order->products[$i]['element_type']=="S" && $order->products[$i]['id']==$subscription_id) //purchased
				{
				} else{
			     $products_name.='    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_product_small_image($products[$i]['image'], $products[$i]['title']) . '</a></td>' .
						   '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
						}   
		  }
	  }else{ 
		  if ($products[$i]['element_type']=='E'){
			  $products_name.=  '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SESSION_DETAILS, 'events_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
		  } else if ($products[$i]['element_type']=='S'){
			  $products_name.=  '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SUBSCRIPTION_INFO, 'subscription_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>' . 
						   ' <br>' . TEXT_TYPE . $type_array[$products[$i]["subscription_type"]] . '';
		  }else if ($products[$i]['element_type']=='V'){
				$prid=tep_get_service_prid($products[$i]['id']);
				$products_name.='    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_SERVICES_INFO, 'service_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
				$products_id=$products[$i]['id']; 
		  } else {
		  		$products_name.=  '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
				 //  $category_qry = tep_db_query("select categories_name from categories_description where categories_id=". $HTTP_GET_VARS['cPath'] );
				//   $prd_cat_name = tep_db_fetch_array($category_qry);
			 // $products_name.='    <td class="productListing-data" align="left">' . $products[$id]['category_name'] . '</td>';
			}
	  }
 //show check_box only in shopping cart page
    if(basename($PHP_SELF) == 'shopping_cart.php'){
				if($products[$i]['subscription_type']!="M"){
				$info_box_contents[$cur_row][] = array('align' => 'center',
											 'params' => 'class="productListing-data" valign="top"',
											 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['sh_id']) . tep_draw_hidden_field('products_type[]', $products[$i]['element_type']));
											 }
	/*}else{
		$info_box_contents[$cur_row][] = array('align' => 'right',
											 'params' => 'class="productListing-data" valign="top" width=25',
											 'text' => '<b>' . $products[$i]['name'] .'</b>');*/
	}
	
	if ($products[$i]['element_type']=='P'){
		if (STOCK_CHECK == 'true') {
			$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
			if (tep_not_null($stock_check)) {
				$any_out_of_stock = 1;
				$products_name .= $stock_check;
			}		
		}
		if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
			$attrb_ids="";
			$attribute_stock_check="";
			reset($products[$i]['attributes']);
			//print_r ($products[$i]['attributes']);
			while (list($option, $value) = each($products[$i]['attributes'])) {
		//  	$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
				$attrb_ids.=$option . "{".$value."}-";
			}
			$attrb_ids=substr($attrb_ids,0,-1);
			reset($products[$i]['attributes']);
			while (list($option, $value) = each($products[$i]['attributes'])) {  
				//if(basename($PHP_SELF) == 'shopping_cart.php'){
					if($products[$i][$option]['products_options_name'])
						$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . ' ' . ' - '. $currencies->display_price($products[$i][$option]['options_values_price'] , tep_get_tax_rate($products[$i]['tax_class_id']), 1) .'</i></small>';
			//	} 
				if (STOCK_CHECK == 'true') {
					$attribute_stock_check=tep_check_attribute_stock($products[$i]['id'],$attrb_ids,$products[$i]['quantity']);
					if(tep_not_null($attribute_stock_check)){
						$any_out_of_stock=1;
						$products_name.=$attribute_stock_check;
					}
				}
			}
		/*	while (list($option, $value) = each($products[$i]['attributes'])) {
			$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
			if (STOCK_CHECK == 'true') {
				$attribute_stock_check=tep_check_attribute_stock($products[$i]['id'],$option,$value,$products[$i]['quantity']);
				if(tep_not_null($attribute_stock_check)){
					$any_out_of_stock=1;
					$products_name.=$attribute_stock_check;
			}}
			}*/
		}
		$products_name.=(isset($products[$i]['discount_whole_text'])?'<br>' .$products[$i]['discount_whole_text']:'');
	}
	//echo $products_name.'ds';
	if ($products[$i]['element_type']=='V'){
		if($products[$i]['others']['end_date'] && $products[$i]['others']['end_time']){
			$str_time=strtotime($products[$i]['others']['end_date'] .' '.$products[$i]['others']['end_time'])+60;
			$products[$i]['others']['end_date']=date('Y-m-d',$str_time);
			$products[$i]['others']['end_time']=date('H:i:s',$str_time);
		}
		$dis_time_format="";
		if(defined('TIME_FORMAT'))
			$dis_time_format=TIME_FORMAT;
		$s_time="";
		$e_time="";
		if($products[$i]['others']['start_time']) {
			$s_time=date("h:i A",strtotime($products[$i]['others']['start_time']));	
			if($dis_time_format!="") {
				if($dis_time_format=='24') $s_time=date("H:i",strtotime($products[$i]['others']['start_time']));
			}		
		}
		if($products[$i]['others']['end_time']) {
			$e_time=date("h:i A",strtotime($products[$i]['others']['end_time']));
			if($dis_time_format!="") {
				if($dis_time_format=='24') $e_time=date("H:i",strtotime($products[$i]['others']['end_time']));
			}			
		}
			
		$products_name.='<br> - '.TEXT_START_DATE.' : '.(($products[$i]['others']['start_date'])?format_date($products[$i]['others']['start_date']):'') . '&nbsp;' . $s_time . '&nbsp;<br> - ' .TEXT_END_DATE. ' &nbsp;: ' . (($products[$i]['others']['end_date'])?format_date($products[$i]['others']['end_date']):'');
		$products_name.='&nbsp;&nbsp;' . $e_time;
		$tax_class_id_service=$products[$i]['tax_class_id'];
		if($products[$i]['others']['resource_id'])$products_name.='<br> - ' .tep_get_resource_name($products[$i]['others']['resource_id'],'resource_name',$languages_id).'('.$currencies->format($products[$i]['others']['resource_costs']).')';
		if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
			reset($products[$i]['attributes']);
			while (list($option, $value) = each($products[$i]['attributes'])) {
				$option_price=tep_add_tax($products[$i][$option]['options_values_price'],tep_get_tax_rate($tax_class_id_service));
				if($products[$i][$option]['products_options_name'])$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] .'('.(($option_price>0)?(($products[$i][$option]['price_prefix']) . $currencies->format($option_price)):'').')'. '</i></small>';
			}	
		}
	}
	if($products[$i]['sku']) $products_name.="<br>".TEXT_SKU.$products[$i]['sku'];
	$element_type="";	
	$element_type=$products[$i]['element_type'];
	if ($products[$i]['element_type']=='E'){
		$sessions=&$products[$i]['sessions'];
		$dates='';
		reset($sessions);
		while(list($id,$session)=each($sessions)){
			if ($dates!="") $dates.=", ";
			$dates .=date(EVENTS_DATE_FORMAT,strtotime($sessions[$id]['date']));
		}
		$products_name.='<br>' . $dates;
		//group booking
		if($customers_name)	{ 
			if($customer_id=='')
				$products_name.='<br>'.substr($customers_name,0,-1);
			else{	
		    	$start_name=strpos($customers_name,',',1);
		    	// $products_name=substr($customers_name,$start_name+1,-1);
				if($products[$i]['quantity']>1)
					$products_name.='<br>' . '<b>' . TEXT_ATTENDEES . '</b>' .'<br>'.tep_draw_separator('pixel_trans.gif',35,1) .'-'.substr($customers_name,0,-1);
			}
		//group booking
		}
	}
	$products_name .= '    </td>' .
					'  </tr>' .
					'</table>';
					
	$products_name.=tep_draw_hidden_field('discount_ids[]',isset($products[$i]['discount_id'])?(int)$products[$i]['discount_id']:0);
	if(basename($PHP_SELF) == 'shopping_cart.php'){
		if($products[$i]['subscription_type']!="M")
			$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
											 'text' => $products_name);  
	}else{
		if($products[$i]['subscription_type']!="M")
			$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data" valign="top"',
											 'text' => $products_name); 
	}
	//print_r($info_box_contents);
	if(basename($PHP_SELF) == 'shopping_cart.php'){
		//check if element is a product or event
		if ($products[$i]['element_type']=='P'){
		//echo 'hello';
		
			if($products[$i]['weight']>0)
				$show_shipping=true;
		if($products[$i]['product_type']!='S'){	 //Support Packs		
		$is_price_breaks_query=tep_db_query("select products_id,products_price_break from " . TABLE_PRODUCTS . " where products_id='" . $products[$i]['id'] . "'");
		$is_price_breaks_result=tep_db_fetch_array($is_price_breaks_query);
			if ($is_price_breaks_result["products_price_break"]=='Y')
				$input_text=tep_draw_pull_down_menu('cart_quantity[]', $products[$i]["price_breaks"],$products[$i]['quantity']);
			else
				$input_text=tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], ' size="4" style="text-align:center;"');
		} else{
				$input_text=tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']) .$products[$i]['quantity'];	
		}	 // Support Pack
		
		//
		
				
		$info_box_contents[$cur_row][] = array('align' => 'center',
												 'params' => 'class="productListing-data" valign="top"',
											 'text' => $input_text . tep_draw_hidden_field('products_id[]', $products[$i]['sh_id']) . tep_draw_hidden_field('element_type[]', $products[$i]['element_type']));
											 
					$info_box_contents[$cur_row][] = array('align' => 'right',
										  'params' => 'class="productListing-data" valign="top"',
										  //  'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
											'text' => '<span class="PriceText">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '&nbsp;&nbsp;</span>');									 
										 
		}else{
		
					if($products[$i]['subscription_type']!="M"){
			$info_box_contents[$cur_row][] = array('align' => 'center',
												 'params' => 'class="productListing-data" valign="top"',
												 'text' => $products[$i]['quantity'] . tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['sh_id']) . tep_draw_hidden_field('element_type[]', $products[$i]['element_type'])); 
			// no discount price start
			
			$info_box_contents[$cur_row][] = array('align' => 'right',
										  'params' => 'class="productListing-data" valign="top"',
										  //  'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
											'text' => '<span class="PriceText">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '&nbsp;&nbsp;</span>');									 
					}						 
		}
		
		}else { 
		if ($products[$i]['element_type']=='P'){
			if($products[$i]['weight']>0)
				$show_shipping=true;
			$info_box_contents[$cur_row][] = array('align' => 'center',
												 'params' => 'class="productListing-data" valign="top"',
												 'text'   => $products[$i]['category_name']); 
												 //'text' => 'x &nbsp;'. $products[$i]['quantity'] . tep_draw_hidden_field('products_id[]', $products[$i]['sh_id']) . tep_draw_hidden_field('element_type[]', $products[$i]['element_type']));
		}else{ 
			$info_box_contents[$cur_row][] = array('align' => 'center',
												 'params' => 'class="productListing-data" valign="top"',
												 'text' => $products[$i]['category_name'] . tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['sh_id']) . tep_draw_hidden_field('element_type[]', $products[$i]['element_type']));
		}
		
		 /*$info_box_contents[$cur_row][] = array('align' => 'right',
										  'params' => 'class="productListing-data" valign="top"',
										 'text' => 'x '. $products[$i]['quantity'] . tep_draw_separator('pixel_trans.gif',30,5) .'<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');*/
		
					if($products[$i]['subscription_type']!="M"){								 
					$info_box_contents[$cur_row][] = array('align' => 'right',
										  'params' => 'class="smallText" valign="top"',
										 'text' => ' x'. $products[$i]['quantity']);
		$fp1=0;
		   $subs_query=tep_db_query("select sc.subscription_categories_id as cat_id,s.subscription_id as id,s.subscription_costs from " .TABLE_SUBSCRIPTIONS ." s," . TABLE_SUBSCRIPTION_TO_SUBSCRIPTION_CATEGORIES . " sc where s.subscription_id=sc.subscription_id and  s.subscription_type='M' and s.subscription_status='1'");
		   
				$row=tep_db_fetch_array($subs_query);
				$subscription_id=$row['id'];
				$info_box_contents[$cur_row][] = array('align' => 'right',
										  'params' => 'class="productListing-data" valign="top" ',
										 'text' => tep_draw_separator('pixel_trans.gif',30,5) .'<span class="priceText">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</span>' . "&nbsp;&nbsp;");								 
		}
		}
	}

	// no discount price end
    new productListingBox($info_box_contents);
?>
		</td>
	</tr>
	<tr height="10"><?PHP  if(basename($PHP_SELF) == 'shopping_cart.php'){ ?>
		<td><?php  echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		<?php  }else { ?><td align="right">
		<?php  echo tep_image(DIR_WS_IMAGES . 'line.gif');echo '</td>';} ?>
	</tr>
	<tr height="30">
		<?php if(basename($PHP_SELF) == 'shopping_cart.php'){ ?>
    	    <td align="right" class="main"><b>
		<?php  
				echo SUB_TITLE_SUB_TOTAL; 
			 }else{ 
		?>
			<td align="right" class="main" width="100%"><b>
		 <?php 
		 		echo SUB_TITLE_TOTAL;
				echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
				echo tep_draw_separator('pixel_trans.gif',25,5);  
			} 
		// Discount Start
          global $customer_id;
		   $subs_query=tep_db_query("select sc.subscription_categories_id as cat_id,s.subscription_id as id,s.subscription_costs from " .TABLE_SUBSCRIPTIONS ." s," . TABLE_SUBSCRIPTION_TO_SUBSCRIPTION_CATEGORIES . " sc where s.subscription_id=sc.subscription_id and  s.subscription_type='M' and s.subscription_status='1'");
		   $row=tep_db_fetch_array($subs_query);
		    $subscription_id=$row['id'];
			//Hide the Store Membership subscription in the front end. so displaying the total with out store membership
			if($cart->in_cart('S'.$subscription_id))
			{
			 $fp1=$row['subscription_costs'];
			}
			 else {$fp1=0;
			 
			 }

          if (ALLOW_GUEST_TO_SEE_PRICES=='true' && !(tep_session_is_registered('customer_id'))) {
             //echo PRICES_LOGGED_IN_TEXT;
			 echo $currencies->format($cart->show_total()-$fp1);
          } elseif (tep_session_is_registered('customer_id')) {
	       $fp1=$currencies->format($cart->show_total()-$fp1);
            echo '<span class="priceText">'.$fp1 . '&nbsp;&nbsp;</span>'; 
          } else {
             echo PRICES_LOGGED_IN_TEXT;
          }
          //Discount end
		?></b></td>
      </tr>
<?php
    if ($any_out_of_stock == 1) {
      if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
      <tr>
        <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
      </tr>
<?php
      } else {
?>
      <tr>
        <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
      </tr>
<?php
      }
    }
?>

<?php 
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td class="main"><?php if(basename($PHP_SELF) == 'shopping_cart.php') echo tep_template_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
<?php 
    $back = sizeof($navigation->path)-2;
    //if (isset($navigation->path[$back]) && $switch_continue_shopping) {
    if($element_type!='V'){
?>
                <td class="main"><?php  if(basename($PHP_SELF) == 'shopping_cart.php')	echo '<a href="' . tep_href_link(FILENAME_DEFAULT,$HTTP_SESSION_VARS['prev_category_viewed']) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>';
				//echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action','events_type','element_type','products_id','products_qty')), $navigation->path[$back]['mode']) . '">' . tep_template_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>';
				 ?></td>
<?php
    }
?>
                <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SINGLE, '', 'SSL') . '">' . tep_template_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
                </tr>
            </table></td>
          </tr>
        </table></form>
	</td>
      </tr>
      <?php      
      if ($show_shipping==true && $cart->weight>0) { ?>
      <tr>
        <td><?php if(basename($PHP_SELF) == 'shopping_cart.php') require(DIR_WS_MODULES . 'shipping_estimator.php'); ?></td>
      </tr>
      <?php } ?>
<?php
  } else {
?>
      <tr>
        <td align="center" class="main"><?php echo TEXT_CART_EMPTY; ?></td>
      </tr>
<?php 
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_template_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table>