Location: PHPKode > scripts > ECW commerce shop > ecw-commerce-shop-6-03/prev.php
<?
require("./conf.php");

if (($delete=="all") or ($delete=="on"))
 {while (list($tempkey,$tempvalue)=each($zamovl))
    {
        $zamovl[$tempkey]="0";
    }
 }

if ($idtov!=''){
$zamovl[$idtov]=$zamovl[$idtov]+$kil;
 }
if ($t=="no")
{
    while (list($tempkey,$tempvalue)=each($zamovl))
    {
        $tempdel=${"del".$tempkey};
        $tempkil=${"d".$tempkey};
        if ($tempkil=='') {$tempkil=0;}
	$zamovl[$tempkey]=$tempkil;
	if ($tempdel=='on') { $zamovl[$tempkey]='0';}
    }
}

reset ($zamovl);
$usercounttov=count ($zamovl);
//echo "$zamovl - $usercounttov";

$sql="SELECT * FROM $table_prod WHERE (";
$i=1;
$j=0;
while (list($tempkey,$tempvalue)=each($zamovl))
{
 if ($j<>0)
   {
     if ($zamovl[$tempkey]!='0')
     {
     $tempaa=$tempaa." or id=".$tempkey;
     }
    }
 else
   {
    if ($zamovl[$tempkey]!='0')
    {
    $tempaa=" id=".$tempkey;
    $j=1;
    }
   }

  $i++;
}

$sql=$sql.$tempaa.")";

@$res=mysql_query("$sql");

$copyres=mysql_query("$sql");
@$cantrow=mysql_num_rows($copyres);

if ($cantrow=='')
{ echo "<p>
<table border=0 width=400><td>
<font color='#880000' size=+1>
$lang[YSCE]!</font></td><td>
<img src='./empty.gif' border=0></td></tr></table>
<p>
";}
else
{

echo "<form action='./index.php' method='POST'>
      <input type='hidden' name='c' value='$c'>
      <input type='hidden' name='id' value='$id'>
      <input type='hidden' name='t' value='no'>

";

echo "<table cellpading='0' align='center' cellspacing='1' width='600' bgcolor='#ddddee'>";
echo"<td class='menu'>$lang[id]:</td><td class='menu'>$lang[Code]:</td>
     <td class='menu'>$lang[Category]:</td><td class='menu'>$lang[Company]:</td>
     <td class='menu'>$lang[Price]: </td><td class='menu'>$lang[Number]:</td><td class='menu'>$lang[Delete]:</td></tr>";

//echo mysql_errno().": ".mysql_error()."<br>$sql";
while ( @$catt=mysql_fetch_array($res) )
 {$tpp=$zamovl[$catt[0]];
  echo "</tr><td class='hd1'>$catt[1]</td><td class='hd1'>$catt[2]</td><td class='hd1'>$catt[4]</td>".
       "<td class='hd1'>$catt[5]</td>".
       "<td class='hd1'>$catt[6]</td><td class='hd1'><input type='text' name='d$catt[0]' value='$tpp' size=4></td><td class='hd1'>".
       "<input type='checkbox' name='del$catt[0]'></td></tr>\n";
$sum=$sum+$catt[6]*$tpp;
 }

echo "<td class=hd1></td><td class=hd1></td><td class=hd1></td><td class='title'>$lang[Total]:</td><td class=title>$ $sum </td><td class=hd1></td><td><input type='checkbox' name='delete' size=4>-$lang[all]</td></tr>";
echo "</table>";
while (list ($key, $val) = each ($discount))
 {$ds=split (",",$key);
 if (($sum>=$ds[0]) and ($sum<=$ds[1]))
 {$zn=$sum*($val/100); $discl=$val;
 $endd=$sum-$zn;
 $endl=$endd;
 }
 }

$endl=sprintf("%01.2f",$endl);
$endl=ereg_replace(",",".",$endl);
echo "<table border=0 width=300><td><input type='submit' value='$lang[Reorder]'></FORM></td>".
     "<td><p></td>".
     "<td><FORM ACTION='./index.php?c=forms' method='POST'><input type='hidden' name='endsum' value='$endl'><input type='submit' value='$lang[Order]'></FORM></td></tr></table>";

echo "<p><table border=0 cellspacing='1' cellpading='0' width='600'>";
      echo "
 <tr><td width='150' class='hd2'>$lang[Totalprice]: ................. </td><td class='hd3' >$ $sum</td><td width=300></td></td></tr>
 <tr><td class='hd2' width='150'>$lang[Discount]: .................... </td><td class='hd3'>$discl %</td><td width=300></td></tr>
 <tr><td class='hd2' width='150'>$lang[Pricewithdiscount]: .... </td><td class='hd3'>$ $endl </td><td width=300></td></tr>
 </table>";

}
 echo "<p><input type='button' value='$lang[Cw]' onclick=window.close();><center>";
?>
Return current item: ECW commerce shop