Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Random, Changing Errors


forgueam

Recommended Posts

Posted

I am experiencing some stange, random errors that I am having trouble tracking down. To give you an idea of the scenario:

 

The site will be working fine.

Then I will click some link (doesn't matter which), and I get something like the following:

 

Warning: Unexpected character in input: ' in /usr/local/apache/vhosts/ugmc/includes/classes/shopping_cart.php on line 127

Parse error: parse error, unexpected ';', expecting ']' in /usr/local/apache/vhosts/ugmc/includes/classes/shopping_cart.php on line 127

 

Then I will hit refresh, and get something like the following:

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /usr/local/apache/vhosts/ugmc/includes/functions/general.php on line 189

 

Then I will hit refresh one more time, and the page will go back to working like normal.

 

When these random errors occur, then are different each time. And when I looking to the specific line numbers of the files, there are no problems or weird characters. Does anyone have a clue what is happening?

 

Thanks,

Aaron

Posted

can you post the script that you have in

 

includes/classes/shopping_cart.php

 

thanks

at the end of the day the code will be good

Posted
can you post the script that you have in

 

includes/classes/shopping_cart.php

 

thanks

 

 

<?php
require("includes/application_top.php");

if ($_POST['Update'] || $_POST['Update_x'] || $_POST['Checkout'] || $_POST['Checkout_x']) {
	// Update Quantities
	foreach ($_POST as $Field => $Value) {
		if (strstr($Field, "Quantity_")) {
			$ProductID = substr($Field, 9, strlen($Field - 9));
			if ($Value == 0) {
				$cart->remove($ProductID);
			} else {
				$cart->update_quantity($ProductID, $Value);
			}
		}
	}

	// Remove Products
	if (is_array($_POST['Remove'])) {
		foreach ($_POST['Remove'] as $ProductID) {
			$cart->remove($ProductID);
		}
	}

	// Redirect if checking out

	if ($_POST['Checkout'] || $_POST['Checkout_x']) {
		tep_redirect("checkout_addresses.php");
	}
}

include("includes/header.php");
?>

<p><img src="images/header_cart.gif" width="500" height="30" border="0"></p>

<? if ($cart->count_contents() > 0) { ?>
<table width="500" cellpadding="3" cellspacing="2" border="0">
<form name="cart" action="shopping_cart.php" method="post">
	<tr>
		<td valign="top" width="280" class="caption"> <p><b>Product</b></p></td>
		<td valign="top" width="45" class="caption"> <p><b>Price</b></p></td>
		<td valign="top" width="55" class="caption"> <p><b>Quantity</b></p></td>
		<td valign="top" width="70" class="caption"> <p><b>Totals</b></p></td>
		<td valign="top" width="50" class="caption"> <p><b>Remove</b></p></td>
	</tr>
<?
	$CartItems = $cart->get_products();

	foreach ($CartItems as $Item) {
	?>
		<tr>
			<td valign="middle" class="caption3"><p><a href="javascript:popUpImage_horizontal('images/<?=$Item['image']?>');"><img src="images/<?=$Item['image']?>" width="21" height="16" border="0" hspace="4" align="absmiddle"></a><?=$Item['name']?></p></td>
			<td valign="middle" class="caption3" align=right> <p><?=$currencies->display_price($Item['final_price'], tep_get_tax_rate($Item['tax_class_id']))?></p></td>
			<td valign="middle" class="caption3"><p align=center><input name="Quantity_<?=$Item['id']?>" type="text" size="1" value="<?=$Item['quantity']?>"></p></td>
			<td valign="middle" class="caption"><p align=right><?=$currencies->display_price($Item['final_price'], tep_get_tax_rate($Item['tax_class_id']), $Item['quantity'])?></p></td>
			<td valign="middle" class="caption3"><p align=center><input name="Remove[]" type="checkbox" value="<?=$Item['id']?>"></p></td>
		</tr>
	<?
	}
?>
	<tr>
		<td height="15" colspan="5"></td>
	</tr>
	<tr>
		<td valign="top"> </td>
		<td valign="top" colspan="2" class="caption" align="right"><b>Order Subtotal</b></td>
		<td valign="top" class="caption" align="right"><b><?=$currencies->format($cart->show_total())?></b></td>
		<td valign="top"> </td>
		<td></td>
	</tr>
	<tr><td height="5" colspan="5"> </td></tr>
	<tr>
		<td colspan="5" align="right">
			<input name="Update" value="1" type="image" src="images/updatetotal.gif"> <input name="Checkout" value="1" type="image" src="images/proceedtocheckout.gif" onClick="document.forms.cart.submit();">
		</td>
	</tr>
</form>
</table>
<? } else { ?>
<p>You currently have no items in your shopping cart. Please <a href="catalog.php">continue shopping</a>.</p>
<? } ?>

<? include("includes/footer.php"); ?>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

the 1st error you are having is really wierd becase i only have 86 lines in that script so i dont know how it shows 127

 

 

it it showeds 87 then i would know you forgt to close something and i would look for a terminator that was missing

at the end of the day the code will be good

Archived

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

×
×
  • Create New...