issue with minusing price
Posted: Mon Sep 27, 2010 10:36 am
On a site I'm working on there is a shopping cart. I need to get some additional prices to go into the database, but only on some products.
The price goes in fine using the following:
That being my addition for $pack and the original coding. There are about 20-30 packs.
The problem is if I remove the item form the cart this additional fee stays (so where it should be £0 it says £24.95)
The following is the code which deletes the item from the database:
You can see the part I added in to remove the extra 24.95 but, it doesnt work. Can anyone point me in the right direction?
Regards,
Aravona
The price goes in fine using the following:
Code: Select all
if($pack == 'Essentials A0200') {
$totalPrice = $totalPrice + '24.95';
}
if($class->isThere("sessionID","tempcart"," sessionID='".$session_id."'")){
$tempCartID=$class->returnName("tempCartID","tempcart","sessionID",$session_id,'');
$query="UPDATE tempcart SET totalPrice=totalPrice+$totalPrice,
totalQty=totalQty+$totalQty
WHERE sessionID='".$session_id."'";
The problem is if I remove the item form the cart this additional fee stays (so where it should be £0 it says £24.95)
The following is the code which deletes the item from the database:
Code: Select all
if(@$_REQUEST['delID']!=''){
$delID=$_REQUEST['delID'];
$query="SELECT *
FROM tempcartdetail
WHERE tempCartDetailID='".$delID."'";
$result=$class->ResultSet($query);
if($class->NumRows($result)>0){
$row=$class->FetchObject($result);
$query="UPDATE tempcart SET totalPrice=totalPrice-$row->price*$row->qty,
totalQty=totalQty-$row->qty
WHERE tempCartID='".$row->tempCartID."'";
mysql_query($query);
if($row2->pack == 'Essentials A0200') {
$query="UPDATE tempcart SET totalPrice=totalPrice-$row->price-'24.95'
WHERE tempCartID='".$row->tempCartID."'";
mysql_query($query);
}
$query="DELETE FROM tempcartdetail2 WHERE tempCartDetailID='".$delID."'";
mysql_query($query);
$query="DELETE FROM tempcartdetail WHERE tempCartDetailID='".$delID."'";
mysql_query($query);
header('location: '.CART);
exit(0);
}Regards,
Aravona