VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Customization
 Adding limit to coupons
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bgrimsley
Starting Member

USA
2 Posts

Posted - January 24 2004 :  14:39:23  Show Profile  Visit bgrimsley's Homepage  Reply with Quote
I have been trying to modify shopcoupon.asp
I want a coupon to only be good if order totals a certain amount.
For example wholesale customers would enter a code and would get a 25% discount only if they ordered atleast $125.00 worth of products.
or a repeat customer might get a coupon good for $5.00 off on any order over $50.00.

I thought that I could use the couponother field to put in the required order amount to get discount. I added some code to compare total order to the amount in that field but can't make it work. I know vary little about programing.



Bryce Grimsley

jonmadrid
VP-ASP New User

USA
192 Posts

Posted - January 24 2004 :  16:35:57  Show Profile  Visit jonmadrid's Homepage  Reply with Quote
Hi Bryce,

I think I have the solution for you. This code will validate against the couponother field in the coupons table to make sure that the order is amount is above the minimum level for a particular coupon. So, as you mentioned, they would have to order at least a certain amount (say 125.00) in order for the coupon to be valid. Any less than that and they would get an error indicating the minimum level required.

There are two changes you need to make and they should take you less than 5 minutes to make. Here they are:

In Shopcoupon.asp, around line 93 (at the end of the ValidateCoupon sub) insert this code:

*******
'Validate coupons for minimum order amount:
If isNumeric(couponother) Then
If cLng(getSess("OrderProductTotal")) < cLng(couponother) Then
msg= getlang("LangCouponNSF") & " " & FormatCurrency(couponother)
rc=4
exit sub
End If
End If
*******

Save that file and upload. Then, go to your shop admin panel and navigate to the Language configurations. Here you will want to add a record as follows:

*******
lang: English
keyword: langCouponNSF
caption: To redeem the coupon you entered your order must be for at least
*******

You may notice that the caption appears to be cut off at the end. Thats intentional. It's that way because it will display the minimum amount required (couponother) directly after that. Add that record and you're set.

This setup will ignore coupons that either A) have nothing in the couponother field, or B) have something other than a number in that field. That way you won't run into any wierd errors.

I tested this a few times and it worked. Let me know if you have any problems with it though. Hopefully it will do the trick for you.

All the best,

Jon Madrid
--------------------
Madrid Communications
Web Design, Development, and Hosting
www.madridcom.com
Go to Top of Page

bgrimsley
Starting Member

USA
2 Posts

Posted - January 24 2004 :  18:39:13  Show Profile  Visit bgrimsley's Homepage  Reply with Quote
That works great thanks

Bryce Grimsley
Go to Top of Page

dwight
VP-ASP New User

USA
143 Posts

Posted - May 14 2009 :  00:56:32  Show Profile  Reply with Quote
Jon,
does this code still work with vpasp 6.50? For some reason when I create a coupon to save $5 when you spend $25 or more from products in category "17" it subtracts $5 for every item. that isn't how i expected a coupon to work. I want it to total all the products the coupon applies to or all the products from the category it applies to and if the total is more than $25 then subtract $5.
any help would be great.
Dwight
Go to Top of Page

savvymedias
VP-ASP New User

191 Posts

Posted - March 02 2010 :  12:35:28  Show Profile  Visit savvymedias's Homepage  Reply with Quote
Dwight, did you figure this out?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000