Promotional Codes not working
I followed the tutorial you have for creating a promotional code - and uploaded the revised cart.php as well as the WA_Store_cart.php file that the ecart program modifies but the promotional code doesn't work. It seems to not be triggering with the button (it doesn't do anything). However, it DOES work when I hit [ENTER] after typing in the coupon code, so it seems to be setup correctly, except for the button trigger. It doesn't do anything. I've copied all the code that was added to my cart pages below. I assume it's a problem with my form and something not identified correctly? Thanks!
Oh - and also, is there a way to have this promotional code only work on CERTAIN products? Instead of on the entire order? Thanks!
This is on my cart.php:
<?php
if (!session_id()) session_start();
if((((isset($_POST["txtPromoCode"]))?$_POST["txtPromoCode"]:"") != "")) {
$_SESSION["PromoCode"] = "".((isset($_POST["txtPromoCode"]))?$_POST["txtPromoCode"]:"") ."";
}
?>
And this is the form I added to the cart.php:
<form action="" method="post" name="PromoCode">
<table>
<tr>
<th><label for="txtPromoCode">Coupon Code:</label></th>
<td><input name="txtPromoCode" type="text" id="txtPromoCode" /></td>
<td><input id="couponCodebtn" name="txtPromoCode" type="button" value="" /></td>
</tr>
</table>
</form>
And this is the code that was added on my wa_store_cart_PHP.php:
//Discounts
$this->Discounts[] = new WA_eCart_Rule(urldecode("Promotional%20Discount"), true, "WAEC_WA_Store_Cart_PromotionalDiscount");
and
//eCart Rule
function WAEC_WA_Store_Cart_PromotionalDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "WebAssist"))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * 0.10);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}