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
<?php
/*
$Id: customers.php 1739 2007-12-20 00:52:16Z hpdl $
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');
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);
}
$action=$_POST['action'];
if ($action=="save") {
$taxid=$_POST['tax'];
$pid=$_POST['proid'];
$price=getNetPrice($taxid,$_POST['price']+0);
tep_db_query("update products set products_price='$price' where products_id=$pid");
header("location:editprice.php");
}
$srhName=$_POST['srhName'];
$srhPriFrom=$_POST['srhPriFrom']+0;
$srhPriTo=$_POST['srhPriTo']+0;
$srhMan=$_POST['srhMan'];
$srhDes=$_POST['srhDes'];
if ( $srhDes!="" || $srhMan!="" || $srhPriFrom>=0 || $srhPriTo>=0 || $srhName!="" )
{//ËÑË÷
$srh=true;
$tmpsql="";
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'");
$manarr=tep_db_fetch_array($manquery);
if($manid=$manarr["manufacturers_id"])
$tmpsql.=" and p.manufacturers_id='$manid'";
else
$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; ?>>
<head>
<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>
</head>
<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">
<tr>
<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 //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<?php
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">
<tr>
<td class="pageHeading"> <?php echo "Edit Product Gross Price."; ?> </td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText" align="right">
<?php
//$productpagequery= tep_db_query($sqlstr);
//$numrows=tep_db_num_rows($productpagequery);
//$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');
?>
</td>
</tr>
</table>
<table width="100%" class="smalltext">
<tr>
<td colspan="7"><?php echo tep_black_line(); ?></td>
</tr>
<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>
</tr>
<tr>
<td colspan="7"><?php echo tep_black_line(); ?></td>
</tr>
<?php
while ($proarr=tep_db_fetch_array($products_query)){
$color+=1;
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>
<td>
£<input type="text" name="price" value="<? echo getGrossPrice($proarr['products_tax_class_id'],$proarr['products_price'])?>" />
</td>
<td><input type="submit" value="save"></td>
</tr>
<?
echo '</form>';
}
?>
</table>
</td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Many thanks ... Dennis









