close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

coupon discounts not clearing in cart

Thread began 7/19/2012 11:34 pm by robvoigt9434728 | Last modified 7/25/2012 11:24 am by robvoigt9434728 | 909 views | 8 replies |

robvoigt9434728

coupon discounts not clearing in cart

I successfully added a couple of coupon discounts to my cart by following the PDF "eCart - Adding Coupons to Your Cart".

However I noticed that the entered coupon code is not clearing out of the cart when a new Session is started.

What would I need to do to make sure any coupon code entered is "killed" when the cart is cleared by either clearing the cart or a completed transaction?

Thanks in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

to clear the coupon session when the clear cart button is pressed, add a Clear Session Value behavior to the cart display page.

From the Server Behaviors panel, click the plus button and select WebAssist -> Cookies -> Clear Session values. For the trigger, select the Clear Cart button pressed, and select the Coupon session to be cleared.


on the success page, add the folllowing code to destroy the session after the closing </html> tag:

php:
<?php

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    
$params session_get_cookie_params();
    @
setcookie(session_name(), ''time() - 42000,
        
$params["path"], $params["domain"],
        
$params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
@session_destroy();
@
session_regenerate_id();
?>
Sign in to reply to this post

robvoigt9434728

I do not see a trigger choice for Clear Cart button pressed when setting the server behavior to clear Session values. I only see Button:button pressed. When I choose that trigger, the discounts remain after clicking Clear Cart button. Attached is a screenshot of the Clear Session Value window.

Do you have any idea why I don't see the Clear Cart button trigger?

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please.

Sign in to reply to this post

robvoigt9434728

Here is the cart page zipped. Notice the discounts aren't working after trying to set the clear session for the Clear cart button.

Attached Files
cart.php.zip
Sign in to reply to this post

robvoigt9434728

I think the reason I don't see the trigger choice for Clear Cart button pressed is because the of where I place the field and button for the discounts. I'm not sure but the only time I would see the clear cart trigger choice is when I put the discount fields in a div that was outside of the main cart div. That is the file I sent you last night.

The attached cart is with the coupon field inside the main cart div. I manually entered ""eCart1_Clear_100_x"" in the code for the ClearSession behavior. I got that button choice from the version where the discount fields were outside the main div. This appears to work fine, BUT now my main Checkout button is doing nothing when going to check out with something in the cart.

So I guess that is now my main question. Checkout button not working.

Sign in to reply to this post

robvoigt9434728

Here is the cart page file. Thanks for you help.

Attached Files
cart.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the main cart div is a form.

when you moved the promo code text box into the main cart div, you also moved the form tag, so now you have a form in a form, which not valid.


change:
<form action="" method="post" name="CouponCode" id="CouponCode">
<label for="txtPromoCode">Promo Code:</label>
<input type="text" name="txtPromoCode" id="txtPromoCode" />
<input type="submit" name="button" id="button" value="Submit" />
</form>


to:

<label for="txtPromoCode">Promo Code:</label>
<input type="text" name="txtPromoCode" id="txtPromoCode" />
<input type="submit" name="button" id="button" value="Submit" />


or move the promo code form outside the main cart div.

Sign in to reply to this post

robvoigt9434728

That was it, thanks Jason!

Sign in to reply to this post

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...