I tried to set up to session variables with this code:
<?php
if (!session_id()) session_start();
if((((isset($_POST["coupon"]))?$_POST["coupon"]:"") != "")) {
$_SESSION["CouponCode"] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
$_SESSION["CouponCode2"] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if(!($totalRows_coupon == 0)) {
$_SESSION["CouponAmount"] = "".$row_coupon['Amount'] ."";
$_SESSION["CouponAmount2"] = "".$row_coupon['Amount'] ."";
}
?>
The discount rules are as follows:
//eCart Rule
function WAEC_iembroider_FamilyDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponCode'])) && ((isset($_SESSION['CouponCode'])?$_SESSION['CouponCode']:"") != "freeship523") && (isset($_SESSION['CouponAmount'])))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * $_SESSION['CouponAmount']);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_iembroider_FreeShipping() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponCode2'])) && ((isset($_SESSION['CouponCode2'])?$_SESSION['CouponCode2']:"") == "freeship523") && (isset($_SESSION['CouponAmount2'])))) {
$totalDiscount += $this->GetShipping();//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
The Family Discount is based on $_Session ['CouponCode'] and the Free Shipping Discount is based on $ Session ['CouponCode2'], but for some reason they still just overwrite each other in the cart. Any thoughts?