by anyss Mon Jul 27, 2009 5:37 pm
actually,sy dh wt order form tanpa mengikut kategori dan codenya:
<h1 class="contentheading"><?=JText::_('Order form');?></h1>
<script language="JavaScript" type="text/javascript">
window.onload=updatePrice;
function updatePrice() {
price = 0;
<?
foreach ($this->rows as $row) {
$price = $row->price;
$vat = $row->vat_percent;
if($row->vat_included == 0)
{
$price_without = $price;
$price = round( $price +($price/100)*$vat ,2);
$jsCalc = "quantity * ".$price_without." + ( quantity * ".$price_without.")/100 *".$vat;
} else {
$price_without = round($price/(1+$vat/100), 2);
$jsCalc = "quantity * ".$price;
}
?>
if (!isNaN(document.forms["orderForm"].quantity_<?=$row->id;?>.value)) {
quantity = document.forms["orderForm"].quantity_<?=$row->id;?>.value;
price += <?=$jsCalc;?>;
}
<?
} //end foreach
?>
price_total=document.getElementById("total");
//round to 2 decimals
price = Math.round(price*Math.pow(10,2))/Math.pow(10,2);
price_total.innerHTML=price;
}
</script>
<? if(!empty($this->error)) { ?>
<dl id="system-message">
<dt class="error">Error</dt>
<dd class="error message fade">
<ul>
<?
foreach ($this->error as $err) {
echo "<li>";
echo $err;
echo "</li>";
}
?>
</ul>
</dd>
</dl>
<? } //end if error ?>
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>" id="orderForm" name="orderForm">
<table>
<tr>
<td><input type="text" value="<?=$this->data['name'];?>" name="name" class="inputbox" size="50" /></td>
<td><?=JText::_('NAME');?> *</td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['surname'];?>" name="surname" class="inputbox" size="50" /></td>
<td><?=JText::_('SURNAME');?> *</td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['company'];?>" name="company" class="inputbox" size="50" /></td>
<td><?=JText::_('COMPANY');?></td>
</tr>
<tr>
<td style="height:5px;"></td>
<td></td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['address'];?>" name="address" class="inputbox" size="50" /></td>
<td><?=JText::_('ADDRESS');?> *</td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['zip_code'];?>" name="zip_code" class="inputbox" size="50" /></td>
<td><?=JText::_('ZIP');?> *</td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['city'];?>" name="city" class="inputbox" size="50" /></td>
<td><?=JText::_('CITY');?> *</td>
</tr>
<tr>
<td style="height:5px;"></td>
<td></td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['email'];?>" name="email" class="inputbox" size="50" /></td>
<td><?=JText::_('EMAIL');?> *</td>
</tr>
<tr>
<td><input type="text" value="<?=$this->data['phone'];?>" name="phone" class="inputbox" /></td>
<td><?=JText::_('PHONE');?></td>
</tr>
</table>
<hr />
<table width="451">
<thead>
<tr>
<th width="223"><?=JText::_('PRODUCT');?></th>
<th width="112"><?=JText::_('PRICE');?></th>
<th width="48"><?=JText::_('QUANTITY');?></th>
<th width="48"><?=JText::_('TOTAL PRICE');?></th>
</tr>
</thead>
<tbody>
<?
foreach ($this->rows as $row) {
$price = $row->price;
$vat = $row->vat_percent;
if($row->vat_included == 0)
{
$price_without = $price;
$price = round( $price +($price/100)*$vat ,2);
} else {
$price_without = round($price/(1+$vat/100), 2);
}
?>
<tr class="" onmouseout="this.className=''" onmouseover="this.className='product_hover'">
<td style="width:200px;"><?=$row->title;?></td>
<td style="width:100px;">RM <?=$price;?></td>
<td><input type="text" value="<?=$this->data['quantity_'.$row->id];?>" name="quantity_<?=$row->id;?>" class="inputbox" size="5" onkeyup="updatePrice()" /></td>
<td> </td>
</tr>
<?
} //end foreach
?>
</tbody>
</table>
<p> </p>
<hr />
<div style="padding-left:420px;">
<?=JText::_('ORDER TOTAL PRICE');?>: RM <span id="total">0.00</span></div>
<hr />
<?=JText::_('NOTES');?>:<br/>
<textarea name="notes" class="inputbox" style="width:300px; height:100px;"><?=$this->data['notes'];?></textarea><br/><br/>
<input class="button" type="submit" value="<?=JText::_('SEND ORDER');?>" name="Submit"/>
<input type="hidden" name="task" value="add" />
</form><br/><br/><br/><br/>
sy still lagi takdpt nk wt order form mengikut kategori...
ada tak sesiapa boleh bantu sy berdasarkn code di atas spy order sy mengikut kategori...
terima kasih..