Site maintenance: Sun 15 Nov, from 20:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / Discount coupons for category is not working,error MySQL

Discount coupons for category is not working,error MySQL

Started by rimo on 6 Oct 2011, 6:11 AM · Views: 1,331

Results 1 to 10 of 10
6 Oct 2011, 6:11 AM
#1
rimo avatar

rimo

New Zenner

Join Date:
Jan 2011
Posts:
88
Plugin Contributions:
0

Discount coupons for category is not working,error MySQL

Hello,
I have set up a discount coupon,but I want to give 10% discount for a specific category.
This needs to be done via restrictions I suppose?
But if I click on restrictions I get the following error:

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, MAX_DISPLAY_RESTRICT_ENTRIES' at line 1
in:
[select * from coupon_restrict where coupon_id = '2' and category_id != '0' limit -0, MAX_DISPLAY_RESTRICT_ENTRIES]
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.

What is wrong and what can I do to solve this problem?

I am using latest version of Zen-Cart.

Or is there maybe an addon to get a discount coupon working for a specific category?
Looking forward to get some advice.

Thanks in advance.
Richard

6 Oct 2011, 6:37 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Discount coupons for category is not working,error MySQL

Rimo:

But if I click on restrictions I get the following error:

*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, MAX_DISPLAY_RESTRICT_ENTRIES' at line 1
*

There is something amiss with your installation.

Where you are seeing "MAX_DISPLAY_RESTRICT_ENTRIES" it should be showing a number (default = 20).

This is/should be set/defined in the file:
/admin/includes/languages/english/coupon_restrict.php

The Dev Toolkit indicates that this setting is defined on line#27 of this file. By default it should read:
define('MAX_DISPLAY_RESTRICT_ENTRIES', 20);

What does it read for your store?

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

6 Oct 2011, 7:14 AM
#3
rimo avatar

rimo

New Zenner

Join Date:
Jan 2011
Posts:
88
Plugin Contributions:
0

Re: Discount coupons for category is not working,error MySQL

RodG:

There is something amiss with your installation.

Where you are seeing "MAX_DISPLAY_RESTRICT_ENTRIES" it should be showing a number (default = 20).

This is/should be set/defined in the file:
/admin/includes/languages/english/coupon_restrict.php

The Dev Toolkit indicates that this setting is defined on line#27 of this file. By default it should read:
define('MAX_DISPLAY_RESTRICT_ENTRIES', 20);

What does it read for your store?

Cheers
Rod

Hi Rod,

Thanks for your answer.
I am at my work right now and I do not have access to a ftp manager to check the file you mentioned.
Is there another how I can checkthis right now,otherwise I have to wait for about 10 hours to check this :cry:

Richard

6 Oct 2011, 7:35 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Discount coupons for category is not working,error MySQL

Rimo:

I do not have access to a ftp manager.
Is there another how I can checkthis right now,otherwise I have to wait for about 10 hours to check this :cry:

Most hosts provide a file manager with their control panels, so this is one way you can check.

Also, if your host allows SSH access you can download a program called 'PuTTY' (google it). and gain access to your files that way.

Finally, most web browsers provide reasonably good FTP support these days, so you almost certainly DO have access to 'an ftp manager', but you simply don't know it.

Instead of accessing your site with
http://yourserver.com/ simply replace the 'http' with 'ftp'. as such:
ftp://yourserver.com/
you might be pleasantly surprised (or perhaps shocked that such access is even possible).

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

6 Oct 2011, 12:29 PM
#5
rimo avatar

rimo

New Zenner

Join Date:
Jan 2011
Posts:
88
Plugin Contributions:
0

Re: Discount coupons for category is not working,error MySQL

Hi,

I just checked the files and here they are:

By the way I am using the dutch versions so you will find here two files of coupon_restrict.php

admin/includes/language/english

<?php
/**
 * @package admin
 * @copyright Copyright 2003-2010 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: coupon_restrict.php 16174 2010-05-02 14:10:30Z drbyte $
 */

define('HEADING_TITLE', 'Discount Coupons Product/Category Restrictions');
define('HEADING_TITLE_CATEGORY', 'Category Restrictions');
define('HEADING_TITLE_PRODUCT', 'Product Restrictions');

define('HEADER_COUPON_ID', 'Coupon ID');
define('HEADER_COUPON_NAME', 'Coupon Name');
define('HEADER_CATEGORY_ID', 'Category ID');
define('HEADER_CATEGORY_NAME', 'Category Name');
define('HEADER_PRODUCT_ID', 'Product ID');
define('HEADER_PRODUCT_NAME', 'Product Name');
define('HEADER_RESTRICT_ALLOW', 'Allow');
define('HEADER_RESTRICT_DENY', 'Deny');
define('HEADER_RESTRICT_REMOVE', 'Remove');
define('IMAGE_ALLOW', 'Allow');
define('IMAGE_DENY', 'Deny');
define('IMAGE_REMOVE', 'Remove');
define('TEXT_ALL_CATEGORIES', 'All Categories');

define('MAX_DISPLAY_RESTRICT_ENTRIES', 20);
define('TEXT_ALL_PRODUCTS_ADD', 'Add All Category Products');
define('TEXT_ALL_PRODUCTS_REMOVE', 'Remove All Category Products');
define('TEXT_INFO_ADD_DENY_ALL', '<strong>For Add all Category Products, only Products not already set for restrictions will be added.<br />
                    For Delete all Category Products, only Products that are specified Deny or Allow will be removed.</strong>');

define('TEXT_MANUFACTURER', 'Manufacturer: ');
define('TEXT_CATEGORY', 'Category: ');
define('ERROR_DISCOUNT_COUPON_DEFINED_CATEGORY', 'Category Not Completed');
define('ERROR_DISCOUNT_COUPON_DEFINED_PRODUCT', 'Product Not Completed');

admin/includes/languages/dutch

<?php
//dutch translation Zencart ; v1.3.7 2007-09-11 by Edwin Wiering ; v1.3.5 2006-09-04 by joostvdl ; dutch translation Zencart v1.2.6d 2005-11-12  by dutchguy 
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |   
// | http://www.zen-cart.com/index.php                                    |   
// |                                                                      |   
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id: coupon_restrict.php 3666 2006-05-28 21:21:37Z wilt $
//

define('HEADING_TITLE', 'Kortingsbonnen Artikel/Categorie beperkingen');
define('HEADING_TITLE_CATEGORY', 'Categorie beperkingen');
define('HEADING_TITLE_PRODUCT', 'Artikel beperkingen');

define('HEADER_COUPON_ID', 'Kortingsbon ID');
define('HEADER_COUPON_NAME', 'Naam kortingsbon');
define('HEADER_CATEGORY_ID', 'Categorie ID');
define('HEADER_CATEGORY_NAME', 'Categorienaam');
define('HEADER_PRODUCT_ID', 'Artikel ID');
define('HEADER_PRODUCT_NAME', 'Artikelnaam');
define('HEADER_RESTRICT_ALLOW', 'Toestaan');
define('HEADER_RESTRICT_DENY', 'Weigeren');
define('HEADER_RESTRICT_REMOVE', 'Verwijderen');
define('IMAGE_ALLOW', 'Toestaan');
define('IMAGE_DENY', 'Weigeren');
define('IMAGE_REMOVE', 'Verwijderen');
define('TEXT_ALL_CATEGORIES', 'Alle Categorieën');
?>

I copied this from the files,but at the end of admin/includes/languages/english/coupon_restricted.php i am missing ?> can this be a problem?

6 Oct 2011, 1:55 PM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Discount coupons for category is not working,error MySQL

Rimo:

By the way I am using the dutch versions so you will find here two files of coupon_restrict.php

If I'd known that I would have suggested that you simply change languages to see if the problem goes away.

Not needed now though, I see where your problem is.

The dutch version of this file is based on an older version of zencart, as such, some of the defines are missing, including the one under discussion.

You will need to add these missing defines to your dutch file. Just copy them over from the english one and edit as needed.

As for the missing "?>" - No, this will NOT cause you any problems. It is supposed to be that way. It should be removed from the dutch file when you update it with the missing entries.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

6 Oct 2011, 2:22 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Discount coupons for category is not working,error MySQL

Your dutch file appears to be missing a number of defines that are in the english ...

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!

6 Oct 2011, 7:53 PM
#8
rimo avatar

rimo

New Zenner

Join Date:
Jan 2011
Posts:
88
Plugin Contributions:
0

Re: Discount coupons for category is not working,error MySQL

Thank you all :clap:
You were right,the problem was the dutch file.
I copied the english to the dutch file,problem solved :D

6 Oct 2011, 8:39 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Discount coupons for category is not working,error MySQL

You are most welcome ... thanks for the update that your language file was out of date ... :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!

15 Jun 2012, 9:30 AM
#10
digiwinkel avatar

digiwinkel

New Zenner

Join Date:
Jul 2010
Location:
Velsen-Zuid
Posts:
33
Plugin Contributions:
0

Re: Discount coupons for category is not working,error MySQL

Rimo:

Thank you all :clap:
You were right,the problem was the dutch file.
I copied the english to the dutch file,problem solved :D

GREAT!!! They are missing in the Russian language files too,... Thanks!