Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Problem with editprice.php

Recommended Posts

My store is running Oscommerce 2.2 RCa2 and I am just about finished upgrading requirements to move from php 5.2 to 5.3


I seem to have a problem with my edit price file which is accessed from the admin area via Catalogue - Edit Product Price. When I select that I get the following error


Parse error: syntax error, unexpected $end in C:\Documents and Settings\DHL\My Documents\xampp\htdocs\mywebsite.co.uk\admin\editprice.php on line 189


I have gone back to php 5.2 and the editprice.php works fine.


I have checked all the normal changes for php 5.3 but it must be something different.


Be very grateful if anyone can tell me what the problem is.


Code for editprice.php

$Id: customers.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
function getTaxRate($tax_id) {
return  tep_get_tax_rate_value($tax_id);
function getGrossPrice($taxid,$NETprice) {
$taxRate = getTaxRate($taxid);
if ($taxRate > 0) {
 $grossPrice = $NETprice * (($taxRate / 100) + 1);
  return round($grossPrice,4);
function getNetPrice($taxid,$grossPrice)
$taxRate = getTaxRate($taxid);
if ($taxRate > 0) {
 $NETprice = $grossPrice / ((1+$taxRate / 100) );
  return round($NETprice,4);
if ($action=="save") {
tep_db_query("update products set products_price='$price' where products_id=$pid");
if ( $srhDes!="" || $srhMan!="" || $srhPriFrom>=0 || $srhPriTo>=0 || $srhName!=""  )
 if ($srhName)
 $tmpsql=" and pd.products_name like '%$srhName%' ";
 if ($srhPriFrom>0)
 //$tmpsql.=" and p.products_price>=$srhPriFrom";
 $tmpsql.=" and p.products_tax_class_id =tr.tax_class_id and p.products_price>=$srhPriFrom/(tr.tax_rate/100+1) ";
 if ($srhPriTo>0)
 //$tmpsql.=" and p.products_price<=$srhPriTo";
 $tmpsql.=" and p.products_tax_class_id =tr.tax_class_id and p.products_price<=$srhPriTo/(tr.tax_rate/100+1) ";
 if ($srhMan)
  $manquery=tep_db_query("select manufacturers_id,manufacturers_name from manufacturers where manufacturers_name='$srhMan'");
  $tmpsql.=" and p.manufacturers_id='$manid'";
  $tmpsql.=" and p.manufacturers_id='0'";
 if ($srhDes)
 $tmpsql.=" and pd.products_description like '%$srhDes%' ";
$sqlstr="select DISTINCT p.products_tax_class_id, p.products_id, p.products_model, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, tax_rates tr  where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'  $tmpsql order by p.products_model";
$products_query = tep_db_query($sqlstr);
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html <?php echo HTML_PARAMS; ?>>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
<!-- body_text //-->
<td width="100%" valign="top"> 

echo  tep_draw_form("search","editprice.php","","post");
echo tep_draw_hidden_field("action","search");
echo "<table class=smalltext><tr>
  </td><td> Name:</td><td>";
echo tep_draw_input_field("srhName");
echo " </td><td>Gross Price From:</td><td>";
echo tep_draw_input_field("srhPriFrom");
echo "</td><td> Keyword In Product Description:</td><td>";
echo tep_draw_input_field("srhDes");
echo "</td></tr><tr><td>Manufacturer:</td><td>";
echo tep_draw_input_field("srhMan");
echo " </td><td>Gross Price To:</td><td>";
echo tep_draw_input_field("srhPriTo");
echo "</td><td>".tep_draw_input_field("","search","",false,"submit")."</td></tr></table></form>";


	<table border="0" width="100%" cellspacing="0" cellpadding="0">
		<td class="pageHeading"> <?php echo "Edit Product Gross Price."; ?> </td>
	<table border="0" width="100%" cellspacing="0" cellpadding="2">
		<td class="smallText" align="right">
//$productpagequery= tep_db_query($sqlstr);
//$attributes_split = new splitPageResults(1, 10, $sqlstr,$numrows);
//$option_page = (isset($HTTP_GET_VARS['option_page']) && is_numeric($HTTP_GET_VARS['option_page'])) ? $HTTP_GET_VARS['option_page'] : 1;
//$options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_id";
//$options_split = new splitPageResults($option_page, MAX_ROW_LISTS_OPTIONS, $options, $options_query_numrows);
//echo $attributes_split->display_links($numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $attribute_page, 'option_page=' . $option_page . '&value_page=' . $value_page, 'attribute_page');

<table width="100%" class="smalltext">
		<td colspan="7"><?php echo tep_black_line(); ?></td>
<tr class="dataTableHeadingRow">
<td width="10%" class="dataTableHeadingContent">Product ID</td>
  <td width="15%" class="dataTableHeadingContent">Product Model</td>
   <td width="45%" class="dataTableHeadingContent">Product Name</td>
	  <td width="20%" class="dataTableHeadingContent">Gross Price</td>  
	   <td width="20%" class="dataTableHeadingContent">Save</td>
		<td colspan="7"><?php echo tep_black_line(); ?></td>
while ($proarr=tep_db_fetch_array($products_query)){
echo  tep_draw_form("price"."$color","editprice.php","post");
<tr class="<?php echo (floor($color/2) == ($color/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<input type="hidden" value="<? echo $proarr['products_id']?>" name="proid">
<input type="hidden" name="action" value="save">
<input type="hidden" name="tax" value="<?php echo  $proarr['products_tax_class_id']; ?>">
<td ><? echo $proarr['products_id']?></td>
 <td ><? echo $proarr['products_model']?></td>
   <td ><? echo $proarr['products_name']?></td>  
   £<input type="text" name="price" value="<? echo getGrossPrice($proarr['products_tax_class_id'],$proarr['products_price'])?>" />
	<td><input type="submit" value="save"></td>
echo '</form>';

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


Many thanks ... Dennis

Link to comment
Share on other sites

Hello Chris


Thanks for your reply


The reason I put the issue into General "add ons" is because it is not an oscommerce core file.


I copied the contents of the file from Dreamweaver.


Dreamweaver says there are 189 lines and I checked the content of thef file and it is the same as I pasted above.


Does your application ignore white space - maybe thats why there is a difference ?


line 189 is the last line in the file ie <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Best Regards ... Dennis

Link to comment
Share on other sites






Use Notepad++ or Editplus+ for best results.



If the line in question is <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


I suggest you look at that file for the error.




Link to comment
Share on other sites

At the bottom of the file in this code:


	   £<input type="text" name="price" value="<? echo getGrossPrice($proarr['products_tax_class_id'],$proarr['products_price'])?>" />
			<td><input type="submit" value="save"></td>
	echo '</form>';


You have TWO opening PHP short tags:that look like this:




Change them to this:



If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.


"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -


"Headers already sent" - The definitive help


"Cannot redeclare ..." - How to find/fix it


SSL Implementation Help


Like this post? "Like" it again over there >

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...