Question : How to add a coupon to the highest price product

Hello Experts-

I have a php/mysql shopping cart that I built that includes the ability to subtract coupons. I would like to implement a coupon that deducts a percentage from only the highest price item in the cart. I can't figure out the best way to do this.

Can  someone give me some direction in this area?

Answer : How to add a coupon to the highest price product

say your function to get the productid ist getid() then the code changes to:

$maxprice = 0;
while (!$WA_Store_Cart->EOF())      {
  if( getid() != "GC") {
    $maxprice = max( $maxprice, $WA_Store_Cart->DisplayInfo("Price") );
    $WA_Store_Cart->MoveNext();
  }
}
$WA_Store_Cart->MoveFirst();
Random Solutions  
 
programming4us programming4us