Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Coupon error with restrictions set

Coupon error with restrictions set

Views: 2,763

Results 1 to 13 of 13
28 Mar 2010, 6:48 PM
#1
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Coupon error with restrictions set

I am getting the following error with coupons when there is a category set to allow and then a product within that category also set to allow, when attempting to use the coupon customers get a blank page with the following message

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND coupon_restrict = 'Y' AND coupon_id = 53 LIMIT 1' at line 3
in:
[SELECT count(*) AS total FROM coupon_restrict AND coupon_restrict = 'Y' AND coupon_id = 53 LIMIT 1] 
```...the error goes away if I remove the category restriction and just keep the product restriction....how do I fix this?

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

28 Mar 2010, 8:15 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

First if you have an Allow on the Category why do you need an Allow on the Product in that Category? :unsure:

I just made a Discount Coupon that is setup as:
TOP DENY
Category 53 ALLOW

Product in Category 53 ALLOW

and I am not getting an error ...

I added Products from Category 53 and did a checkout without a problem ...

I added Products from Category 53 and the Product that is also Allowed and did a checkout without a problem ...

I added Products from Category 53 and the Product that is also Allowed and from another Category and did a checkout without a problem ...

So far I am unable to reproduce the error ...

Where are you seeing this error?

NOTE: you may wish to check the Known Bug Fixes and apply them:
http://www.zen-cart.com/forum/showthread.php?t=82619

And now is a good time to ensure that you have all of the Secure Patches and Updates:
http://www.zen-cart.com/forum/showthread.php?t=131115

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Mar 2010, 8:42 PM
#3
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Coupon error with restrictions set

I have a commercial module addon that gives my designers access to their products, sales and coupons etc through a seperate folder so they don't access the main admin folder and when adding a coupon it is automatically set to allow their master category so the coupon is restricted and not valid on the whole store lol

Many times we gives out coupons that we only want to allow the customers to use on a single product, which is where both those allow restrictions come in.

I could be wrong, but I believe this error is only happening when the coupon is restricted to a single use (not just per customer, but actual one-time use), I have yet to see it happen if the usage is unrestricted or restricted to 2 or more (cross fingers lol) and as soon as I remove the top allow for the category the error doesn't happen any more.

I have all security patches and bugfixes applied....as far as I am aware I didn't miss any, but it could happen LOL

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

28 Mar 2010, 8:52 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

If you only want the Discount Coupon for 1 Product, why not just set to:

TOP DENY

Product wanted ALLOW

Now it is only good on 1 Product ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Mar 2010, 9:18 PM
#5
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Coupon error with restrictions set

Linda, I do go in and do that after I discover it, but as I said up there lol the mod I have that allows the designers to create their own coupons (without accessing the main admin or anyone else's area/info) sets the category restrictions....otherwise all coupons they create could be used on the whole store and not just their category.

If there's no fix, I will just have to make sure I check for new coupons created regularly lol

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

28 Mar 2010, 9:54 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

So far ... I haven't reproduced the error ...

I will keep fooling with it and see if I can ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Mar 2010, 10:06 PM
#7
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Coupon error with restrictions set

No worries Ajeh, and thanx....I like to bring challenging moments LOL!

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

12 Apr 2010, 11:59 PM
#8
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Coupon error with restrictions set

Ajeh, this issue has been resolved, after several errors I had my programmer track down the problem for me...turned out it was most likely "user error" with me making a mistake when I applied the bugfixes LOL!

includes/functions/functions_general.php

$sql = "SELECT count(*) AS total
            FROM " . TABLE_COUPON_RESTRICT . "
            AND coupon_restrict = 'Y'
            AND coupon_id = " . (int)$coupon_id . " LIMIT 1";
```around line 847 thru 850
changed to

```php
$sql = "SELECT count(*) AS total
            FROM " . TABLE_COUPON_RESTRICT . "
            WHERE category_id = -1
            AND coupon_restrict = 'Y'
            AND coupon_id = " . (int)$coupon_id . " LIMIT 1";
```Thanx for looking into it for me :D

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

13 Apr 2010, 3:03 AM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

Thanks for the update on what the problem was ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Jul 2011, 5:06 PM
#10
semaxd avatar

semaxd

New Zenner

Join Date:
May 2008
Location:
Ventura Co.
Posts:
82
Plugin Contributions:
1

Re: Coupon error with restrictions set

ok so this is the closest thing I have found to my problem.

I just installed the coupon module and when I click on coupon admin i get this;
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-0, 0' at line 1
in:
[select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from zen_coupons where coupon_active='Y' and coupon_type != 'G' limit -0, 0]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields

I went to the file LissaE listed above for my site and it doesnt have that line of code.
(I am presently using: v1.3.9e)
the site has been up fore a year, we just decided to install the coupon module.
http://littlepeoplecustoms.com/toolbox/index.php

any help would be great thanks
jim

29 Jul 2011, 5:43 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

What are the settings in the Configuration ... GV/Coupons ... for:

Maximum Discount Coupons Per Page
Number of Discount Coupons to list per Page

Maximum Discount Coupon Report Results Per Page
Number of Discount Coupons to list on Reports Page

The defaults are 20 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Jul 2011, 5:58 PM
#12
semaxd avatar

semaxd

New Zenner

Join Date:
May 2008
Location:
Ventura Co.
Posts:
82
Plugin Contributions:
1

Re: Coupon error with restrictions set

oh just figured it out i had to set the Maximum Discount Coupons Per Page above 0 in the config tab now were up and runnning :)

haha just saw your post too lol thanks linda!!

29 Jul 2011, 5:59 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Coupon error with restrictions set

Not a problem ... thanks for the update that this was the solution to your issues ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!