Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I fix this problem ?


DingShu

Recommended Posts

Posted

http://www.vteen.vn/shop/index.php?language=en This is my site

 

Take a look at the Shopping Cart, there are two numbers, "0 0 items". I don't know how to fix it

 

This is my shopping_cart.php code

 

<?php
/*
 $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require("includes/application_top.php");

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td class="col_left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
<td width="100%" class="col_center"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0"cellspacing="0" cellpadding="0">
  <tr>
	<td>

<?php tep_draw_heading_top();?>

<? new contentBoxHeading_ProdNew($info_box_contents);?>



<?php
 if ($cart->count_contents() > 0) {
?>

<?php
$info_box_contents = array();/*  
$info_box_contents[0][] = array('align' => 'center',
								'params' => ' class="shop_cart remove"',
								'text' => ''.TABLE_HEADING_REMOVE.'');

$info_box_contents[0][] = array('align' => 'center',
								'params' => ' class="shop_cart products"',
								'text' => ''.TABLE_HEADING_PRODUCTS.'');

$info_box_contents[0][] = array('align' => 'center',
								'params' => ' class="shop_cart quantity"',
								'text' => ''.TABLE_HEADING_QUANTITY.'');

$info_box_contents[0][] = array('align' => 'center',
								'params' => ' class="shop_cart total"',
								'text' => ''.TABLE_HEADING_TOTAL.'');  */
?>

														<table cellpadding="0" cellspacing="0" border="0" style="height:39px; background-image:url(images/1_li.gif)">
															<tr>
																<td width="87" align="center" class="shop_cart vam remove" style="background:url(images/1_q1.gif) left top no-repeat;">    <strong><?php echo TABLE_HEADING_REMOVE;?></strong></td>
																<td width="99" align="center" class="shop_cart vam products"><strong><?php echo TABLE_HEADING_PRODUCTS;?></strong></td>

																<td width="79" align="center" class="shop_cart vam quantity"><strong><?php echo TABLE_HEADING_QUANTITY;?></strong></td>
																<td width="53" align="center" class="shop_cart vam total" style="background:url(images/1_q2.gif) right top no-repeat;"><strong><?php echo TABLE_HEADING_TOTAL;?></strong></td>
															</tr>
														</table>

<?php tep_draw_heading_top_4();?>
<?php									


$any_out_of_stock = 0;
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
  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]['id'] . '][' . $option . ']', $value);
	  $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'];
	}
  }
}

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  if (($i/2) == floor($i/2)) {
	$info_box_contents[] = array('params' => 'class=""'); //  background place  
  } else {
	$info_box_contents[] = array('params' => 'class=""'); //  background place 
  }

  $cur_row = sizeof($info_box_contents) - 1;

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => ' class="remove"',
										 'text' => '<br style="line-height:29px">'.tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

  $products_name = '

				<table cellpadding="0" cellspacing="0" border="0" style=" width:214px;">
					<tr>
						<td>
							<br style="line-height:9px">
							<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>																			
						</td>
						<td style="width:100%">
							<br style="line-height:9px">
							<em>' . substr($products[$i]['name'],0,MAX_DESCR_NAME_SHOPPCART) . '</em>';



  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'])) {
	reset($products[$i]['attributes']);
	while (list($option, $value) = each($products[$i]['attributes'])) {
	  $products_name .= '<br style="line-height:1px;"><br style="line-height:5px;"><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
	}
  }	
	$products_name .= '
					  </td>
					</tr>
				</table><br style="line-height:1px;"><br style="line-height:5px;">
				';


  $info_box_contents[$cur_row][] = array('params' => ' class="products"',
										 'text' => $products_name);

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => ' class="quantity"',
										 'text' => '<br style="line-height:29px">'.tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" id="input1"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => ' class="total"',
										 'text' => '<br style="line-height:29px"><span class="productSpecialPrice">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</span>');
}

  new productListingBox($info_box_contents);
?>

<?php
if ($any_out_of_stock == 1) {
  if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
  <table cellpadding="0" cellspacing="0" border="0">
		  <tr><td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td></tr>
  </table>
<?php
  } else {
?>
  <table cellpadding="0" cellspacing="0" border="0">
		  <tr><td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td></tr>
  </table>
<?php
  }
}
?>
<table cellpadding="0" cellspacing="0" border="0"><tr><td style="height:1px;" class="bg_gg"></td></tr></table>
<table cellspacing="0" cellpadding="0" border="0" class="product">
<tr>
	<td width="80%" align="right" style="vertical-align:middle;text-align:right; height:38px;"><strong><?php echo SUB_TITLE_SUB_TOTAL; ?></strong>       </td>
	<td width="20%" align="center" style=" vertical-align:middle;">														
		<span class="productSpecialPrice"><?php echo $currencies->format($cart->show_total()); ?></span>
	</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0"><tr><td style="height:1px;" class="bg_gg"><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?></td></tr></table>
<table cellspacing="0" cellpadding="0" border="0" >
<tr><td height="19"></td></tr>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '15', '1'); ?><?php echo tep_image_submit('button_update.gif', IMAGE_BUTTON_UPDATE_CART); ?><?php echo tep_draw_separator('pixel_trans.gif', '15', '1'); ?><?php

$back = sizeof($navigation->path)-2;
if (isset($navigation->path[$back])) {

echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping1.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; 
}
?><?php echo tep_draw_separator('pixel_trans.gif', '15', '1'); ?><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
</tr>
<tr><td height="16"></td></tr>
</table>

<?php tep_draw_heading_bottom_4();?>		
<?php
 } else {
?>
<?php tep_draw_heading_top_1();?>	  
<br style="line-height:1px;"><br style="line-height:5px;">


		<table border="0" cellspacing="0" cellpadding="2">
		  <tr>
			  <td></td>
			<td align="center" width="100%"><br><?php new infoBox_77(array(array('text' => TEXT_CART_EMPTY))); ?></td>
			<td></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right" class="main" width="100%"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?><br><br></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		  <tr><td colspan="3" height="5"></td></tr>
		</table>
<?php tep_draw_heading_bottom_1();?>
<?php
 }
?>



<?php tep_draw_heading_bottom();?>

</table></form></td>
<!-- body_text_eof //-->
<td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

Looks like that is in your catalog/includes/header.php. Not sure since it looks like you are using a template. If you can't find it in there, post that file someone might be able to spot it for you.

Posted

Thanks for your reply, Brian

 

This is my header.php

 

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
  $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
}
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
  $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
}
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
if (STORE_SESSIONS == '') {
  if (!is_dir(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
  } elseif (!is_writeable(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
  }
}
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
if (ini_get('session.auto_start') == '1') {
  $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
}
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
  $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
 }

 if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
 }
?>
<!-- start -->
<table cellpadding="0" cellspacing="0" border="0" style="width:708px" align="center"> 
<tr>
	<td>
		<table cellpadding="0" cellspacing="0" border="0" style="height:425px">
			<tr>
				<td>
					<table cellpadding="0" cellspacing="0" border="0" style="height:68px; background:url(images/top.gif)" class="header">
						<tr>
							<td><?php echo tep_image(DIR_WS_IMAGES.'q1.gif')?></td>
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:68px">
									<tr>
										<td>
											<strong><?php echo BOX_HEADING_LANGUAGES?>:</strong><br>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:103px">
									<tr>
										<td><?php
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
$languages_string = '';
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
$languages_string .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>  ';
}
echo $languages_string;
?><br></td>
									</tr>
								</table>
							</td>
							<td><?php echo tep_image(DIR_WS_IMAGES.'z.gif')?></td>
							<td><?php echo tep_draw_separator('spacer.gif', '19', '1'); ?></td>	
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:20px">
									<tr>
										<td><?php echo tep_image(DIR_WS_IMAGES.'z1.gif')?><br></td>
									</tr>
								</table>
							</td>
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:226px">
									<tr>
										<td><strong><?php echo BOX_HEADING_SHOPPING_CART?>  </strong><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a><br></td>
									</tr>
								</table>
							</td>
							<td><?php echo tep_image(DIR_WS_IMAGES.'z.gif')?></td>
							<td><?php echo tep_draw_separator('spacer.gif', '21', '1'); ?></td>
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:69px">
									<tr>
										<td>
											<strong><?php echo BOX_HEADING_CURRENCIES?>:</strong><br>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<table cellpadding="0" cellspacing="0" border="0" style="width:121px">
									<tr>
										<td><?php
echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');
reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
  $currencies_array[] = array('id' => $key, 'text' => $value['title']);
}
$hidden_get_variables = '';
reset($HTTP_GET_VARS);
while (list($key, $value) = each($HTTP_GET_VARS)) {
  if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
	$hidden_get_variables .= tep_draw_hidden_field($key, $value);
  }
}
echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" class="jamp"') . $hidden_get_variables . tep_hide_session_id();
echo '</form>';
?></td>
									</tr>
								</table>
							</td>
							<td><?php echo tep_image(DIR_WS_IMAGES.'q2.gif')?></td>
						</tr>
					</table>
					<table cellpadding="0" cellspacing="0" border="0" style="height:357px">
						<tr>
							<td>
								<br style="line-height:15px">
								<a href="<?php echo tep_href_link('index.php')?>"><?php echo tep_image(DIR_WS_IMAGES.'p.jpg')?></a><br>
								<a href="<?php echo tep_href_link('index.php')?>"><?php echo tep_image_button('m1.gif')?></a><a href="<?php echo tep_href_link('products_new.php')?>"><?php echo tep_image_button('m2.gif')?></a><a href="<?php echo tep_href_link('specials.php')?>"><?php echo tep_image_button('m3.gif')?></a><a href="<?php echo tep_href_link('account.php')?>"><?php echo tep_image_button('m4.gif')?></a><a href="<?php echo tep_href_link('contact_us.php')?>"><?php echo tep_image_button('m5.gif')?></a><br>	
								<?php echo tep_image(DIR_WS_IMAGES.'li.gif')?><br>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
<!-- end -->
<?php
 if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
 </tr>
</table>
<?php
 }

 if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="headerInfo">
<td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
 </tr>
</table>
<?php
 }
?>
<!-- start -->
	</td>
</tr>
<tr>
	<td style="background:#272727;">
<!-- end -->

<?php 
define(MAX_DESCR_1,'50');

define(MAX_DESCR_NAME,'35');
define(MAX_DESCR_NAME_SHOPPCART,'35');
define(MAX_DESCR_BESTS,'19');
define(MAX_DESCR_REVIEWS,'50');
define(MAX_DESCR_NAME_BOX,'15');
?>

Posted

I think the problem is this part.

<?php echo BOX_SHOPPING_CART_EMPTY?>

Not sure where that is going to be. I would try catalog/includes/languages/english.php. I'm guessing that define, BOX_SHOPPING_CART_EMPTY, is going to say 0 items. If so remove the 0. If not let me know.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...