close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Setting up Discounts using Coupons in ecart

Thread began 2/21/2011 5:10 pm by Nature Photographer | Last modified 3/01/2011 5:13 pm by Nature Photographer | 3093 views | 10 replies |

Nature Photographer

Setting up Discounts using Coupons in ecart

Hi,

I'm not overly knowledgable when it comes to web development so any help would be appreciated.

I am using ecart 5.03 and want to set up a discount on purchases using a "coupon" or something simular so that only people that know the coupon get the discount.

How would I set this up? The shopping cart process is otherwise all setup and functioning just need to apply this discount to the products.

Thanks in advance!

Sign in to reply to this post

Jason ByrnesWebAssist

In the archived documentation section of the eCart support page:
ecart/

there is a tutorial titled "Creating a Coupon system for your eCart store It was created for eCart 4, but is still relevant for eCart 5, the steps will be exactly the same.

Sign in to reply to this post

Nature Photographer

Thanks Jason

Hi Jason,

That worked like a treat! :-)

I have a couple more quick questions;

How do I now set this coupon only to work during a set period of time, say March 2011?

also

How do I have a message display saying the entered code is not valid?

Thanks again Jason

Sign in to reply to this post

Jason ByrnesWebAssist

In the trigger for the discount, add 2 triggers:

If today is after a certain day:
2/28/2011

AND
If today is before a certain day:
4/1/2011


to show an error if the entered coupon code does not match the one in your discount rule, add another set session value behavior on the cart page, set the trigger to Before page load, set the name to something like realCode and set the value to the same value used in the discount rule.

then add an if statement to compare the two:

php:
<?php if(isset($_SESSION['PromoCode']) && isset($_SESSION['realCode']) && ($_SESSION['PromoCode'] != $_SESSION['realCode'])) { ?>

the promo code entered did not match
<?php ?>
Sign in to reply to this post

Nature Photographer

More assistance needed please

Hi again Jason,

Thanks for all the assistance to date.

I got the first part of your advice to work eg the date of coupon being valid, I don't fully understand the part about creating the secound part.

Where do I put the PHP code you provided and I tried setting the session value behavior on the cart page but not sure if I'm setting it up right as it doesn't seem to work for me.

The "input" coupon word that they have to put in is MGPS, do I put this in the "real code" part you gave?

bookingcart.php
is the page I am trying to set this up on, if that helps.

Sign in to reply to this post

Jason ByrnesWebAssist

if the coupon code in the discount rule "MGPS", then set the "realCode" session variable value to ""MGPS" the trigger for the set session value behavior for the realCode session variable should be Before Page load.

if you are having trouble, send me a copy of the page in a zip archive so I can see the code.

Sign in to reply to this post

Nature Photographer

Page attached

Thanks Jason

I've attached the page as requested...hope this helps

Attached Files
bookingcart.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I dont see where you have added the ifg statement to show the error:

php:
<?php if(isset($_SESSION['PromoCode']) && isset($_SESSION['realCode']) && ($_SESSION['PromoCode'] != $_SESSION['realCode'])) { ?>

the promo code entered did not match
<?php ?>





you dont seam to have this code on your page, add this code where you would like to display the error.

Sign in to reply to this post

Nature Photographer

Still can't get it to work

Jason, I do thank you for your assistance but I still can't get it to work...I said I wasn't a web developer/designer so saying "put this code on the page" doesn't really help me to know where I am putting it. I might be dumb but when told I will remember.

I've included the page again with where I think you meant the code to go (probably I am wrong) but it doesn't work for me...I got an error "Notice: Undefined index: PromoCode in C:\xampp\htdocs\jamesdoylephoto\Bookings\bookingcart.php on line 17" at one stage so I moved the code to a different location and now nothing happens when the wrong coupon is entered.

Attached Files
bookingcart.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I did clarify where the code should go by saying:
add this code where you would like to display the error

I cont tell you exactly where the code should go in your page, it needs to be in the place of your page where you want the error to be displayed.


in design view, place your cursor where the error should go, the switch to code view and paste the code in.


you have changed the code for setting the real code session variable to use the value pf the promo code session:
<?php
if (!session_id()) session_start();
if("" == "") {
$_SESSION["RealCode"] = "".$_SESSION['PromoCode'] ."";
}
?>


it should be using the hard coded value MGPS:
<?php
if (!session_id()) session_start();
if("" == "") {
$_SESSION["RealCode"] = "MGPS";
}
?>

Sign in to reply to this post
loading

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