PDA

View Full Version : Dynamic, Multiple Coupons


psychobilly1165508
04-20-2009, 02:08 PM
My client would like to have multiple coupon codes running at the same time that they control themselves. I've already set-up the database side of this and tried to follow instructions from a post in the archives from Mark Haynes here.

http://www.webassist.com/forums/archives/forumdetail.php?MessageID=%3C45a89c55%242976562c%2 42320c%40www.webassist.com%3A8119%3E

I get this error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
in /xxxx/xxx/xxx/WA_eCart/xxxxcart_PHP.php on line 100

Here's line 98 - 104:
function WAEC_xxxxcart_PromotionDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "$_SESSION['PromoDiscount']"))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * $_SESSION['PromoPrice']);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

Thanks

Ray Borduin
04-20-2009, 03:00 PM
ok so the line with the error is:

if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "$_SESSION['PromoDiscount']"))) {

My guess is that it should be:

if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == $_SESSION['PromoDiscount']))) {

it looks like you had extra quotes around one of the values.

psychobilly1165508
04-20-2009, 03:02 PM
Ok, I fixed the syntax error. The dynamic coupon actually works, but it's only "seeing" the last coupon entry in the database. Theere are 3 different coupons in the database, so I'll need to figure out a way to check against all records.

Any ideas?

psychobilly1165508
04-20-2009, 03:03 PM
Thanks Ray, I just caught that myself. See my post above.