bug found in eCart_PHP recarding discount rules
Hi there, I just finished creating some discount rules in the eCart object. and on uploading to localhost I have the following error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\armadillo\WA_eCart\eCart_PHP.php on line 108
I am attaching the file, I assume the error will also return on my other discount rules.
I assume its a bug since I didnt use any custom coding, I just used the eCart object and my session variables.
How do I fix?
//eCart Rule
//eCart Rule
function WAEC_eCart_AllProductsPercentageDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponDiscount'])) && ((isset($_SESSION['CouponType'])?$_SESSION['CouponType']:"") == "1") && ((isset($_SESSION['CouponGroup'])?$_SESSION['CouponGroup']:"") == "1") && (time() >= strtotime("".$_SESSION['CouponValidFrom'] ."")) && (time() <= strtotime("".$_SESSION['CouponValidTo'] ."")))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * ".$_SESSION['CouponDiscount'] .");//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
.....update...I have found removing some code generated by the eCart Object discount tool to the below works:
[php]
//eCart Rule
//eCart Rule
function WAEC_eCart_AllProductsPercentageDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponDiscount'])) && ((isset($_SESSION['CouponType'])?$_SESSION['CouponType']:"") == "1") && ((isset($_SESSION['CouponGroup'])?$_SESSION['CouponGroup']:"") == "1") && (time() >= strtotime($_SESSION['CouponValidFrom'] ."")) && (time() <= strtotime($_SESSION['CouponValidTo'] ."")))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * $_SESSION['CouponDiscount']);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
[/php]
NOTES: I have removed the following parts:
strtotime("".$_SESSION['CouponValidFrom'] ."") TO strtotime($_SESSION['CouponValidFrom'] ."")
strtotime("".$_SESSION['CouponValidTo'] ."") TO strtotime($_SESSION['CouponValidTo'] ."")
".$_SESSION['CouponDiscount'] ."); TO $_SESSION['CouponDiscount']);
Chris