View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Promotional Codes not working

Thread began 11/17/2009 10:25 am by larsentim278054 | Last modified 11/17/2009 5:13 pm by larsentim278054 | 902 views | 5 replies

larsentim278054

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);
}

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...