Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

I get the following error when hitting checkout:

 

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 'or z2g.zone_id = 0 or z2g.zone_id IS NULL ) ' at line 5

 

SELECT dc2z.geo_zone_id FROM discount_coupons_to_zones dc2z LEFT JOIN zones_to_geo_zones z2g USING( geo_zone_id ) WHERE ( z2g.zone_id= or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id= or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="FINALLY"

 

[TEP STOP]

 

Everything I've read with a similar error states to upgrade OSC, but I have the most current version. I did a test order earlier and everything worked fine. Now that I have officially launched the store, I get the error.

 

Ok, the above error is when a download item is purchased. When a regular item is purchased, I made it through the checkout process(paying via money order) but no discount was given, tax was applied and shipping wasn't added.

 

I posted before but in the wrong area. Thank you for any help!

 

Faithfully,

 

Dawn

Link to comment
Share on other sites

I get the following error when hitting checkout:

 

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 'or z2g.zone_id = 0 or z2g.zone_id IS NULL ) ' at line 5

 

SELECT dc2z.geo_zone_id FROM discount_coupons_to_zones dc2z LEFT JOIN zones_to_geo_zones z2g USING( geo_zone_id ) WHERE ( z2g.zone_id= or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id= or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="FINALLY"

 

[TEP STOP]

 

Everything I've read with a similar error states to upgrade OSC, but I have the most current version. I did a test order earlier and everything worked fine. Now that I have officially launched the store, I get the error.

 

Ok, the above error is when a download item is purchased. When a regular item is purchased, I made it through the checkout process(paying via money order) but no discount was given, tax was applied and shipping wasn't added.

 

I posted before but in the wrong area. Thank you for any help!

 

Faithfully,

 

Dawn

 

 

This is the same error I get.. All I sell is download products so customers will never make it to check out using a coupon code. I would hope someone would take a minute of their time to read the last couple pages and offer some help.. The OSC bug fix does not fix this issue on the catalog side, only the admin side does it fix. Well Dawn I hate to say it but atleast someone else is in the same boat as myself. If you figure anything out please let me know and Ill do the same for you.

Link to comment
Share on other sites

This is the same error I get.. All I sell is download products so customers will never make it to check out using a coupon code. I would hope someone would take a minute of their time to read the last couple pages and offer some help.. The OSC bug fix does not fix this issue on the catalog side, only the admin side does it fix. Well Dawn I hate to say it but atleast someone else is in the same boat as myself. If you figure anything out please let me know and Ill do the same for you.

 

 

Change lines 72-78 in includes/classes/discount_coupon.php from this:

 

		$check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
											  FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
											  LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
												USING( geo_zone_id )
											  WHERE ( z2g.zone_id='.$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
												AND ( z2g.zone_country_id='.$delivery['country_id'].' or z2g.zone_country_id = 0 )
												AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

 

to this:

 

		$check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
											  FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
											  LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
												USING( geo_zone_id )
											  WHERE ( z2g.zone_id = '.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
												AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 )
												AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Thanks for this great contribution.

 

Installed today with many other contributions and all looks good!

 

However, I wasn't receving error messages when I would input the same coupon twice (when I set max use as 1) - the page was just refreshing.

 

So I consulted the helpfile and the fix was indeed there.

 

HOWEVER, athough it works, it copmpletely messes up my STS templated. The error box is way off to the right of the screen and all by right column boxes ae now put below my let coum boxes. The centre text is also below left (ie continuing with the order).

 

Ay ideas?

 

Thanks.

 

 

The suggested fix for errors not displaying in STS is nothing more than a suggestion, since the very nature of STS means you've now got completely custom code. It's sounds like you'll need to tweak the formatting and code a bit to get the display to work. That's all I can tell you.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Here is a screen shot.

 

For some reason the coupon stuff is now working, not sure what I did appart from changing the sort order.

Is the error code relevant to this particular module? Im thinking it may be part of the vouchers and coupon module (CONTRIBUTION] CCGV (trad) ) that I installed but never got to work.

This error code has never shown up previously though until now.

 

1146 - Table 'latori_osc1.TABLE_COUPON_GV_CUSTOMER' doesn't exist

 

 

Yes, this is a part of CCGV - you didn't get it completely uninstalled.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Offbeat problem

 

Whenever I go to edit in a percentage or fixed rate or anything to the coupon and hit "update" it kicks this error back at me:

 

1054 - Unknown column 'coupons_min_order_type' in 'field list'

 

update discount_coupons set coupons_discount_amount = '10.0000000', coupons_discount_type = 'fixed', coupons_description = '', coupons_date_start = null, coupons_date_end = null, coupons_max_use = 0, coupons_min_order = 20.00, coupons_min_order_type = 'price', coupons_number_available = 100 where coupons_id = 'Gaun0807'

 

Obviously those are all the variables, but does this mean that it's not posting to the database? When I create the coupon, it makes it no problem.

 

 

What version are you using?

 

Use phpMyAdmin to get the correct field name for that field in the table discount_coupons.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Change lines 72-78 in includes/classes/discount_coupon.php from this:

 

		$check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
											  FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
											  LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
												USING( geo_zone_id )
											  WHERE ( z2g.zone_id='.$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
												AND ( z2g.zone_country_id='.$delivery['country_id'].' or z2g.zone_country_id = 0 )
												AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

 

to this:

 

		$check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
											  FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
											  LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
												USING( geo_zone_id )
											  WHERE ( z2g.zone_id = '.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
												AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 )
												AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

 

 

Thank You so much KGT! Worked flawlessly in fixing my problem. I find it very honorable that you still offer such great support for this contribution after so long since its first release..

Link to comment
Share on other sites

Thank You so much KGT! Worked flawlessly in fixing my problem. I find it very honorable that you still offer such great support for this contribution after so long since its first release..

 

 

Any suggestions how to fix the double discount problem, being mentioned couple of pages ago?

Link to comment
Share on other sites

Are there any plans to allow more than one coupon per order?

 

Apologies if this is already mentioned somewhere else.

 

Why would you need to offer more than one coupon per order?

 

--------------------------------------------------------------------

 

KGT I noticed that if you enter an incorrect coupon code that it just refreshes the page. What would need to be done in order to show an error message instead? Perhaps refresh the page but then show some bold red letters saying incorrect coupon code.

Link to comment
Share on other sites

Why would you need to offer more than one coupon per order?

 

Coca-Cola 12 packs $2.99 coupon, $3 delivery coupon, $.99 per lb ground beef limit 3 lbs. etc. etc.

 

Many people cut and use coupons with groceries all the time. I want to do the same. (My Site is a grocery store with local home delivery (no shipping) so I sort of compete with the local grocery stores.

Link to comment
Share on other sites

Why would you need to offer more than one coupon per order?

 

--------------------------------------------------------------------

 

KGT I noticed that if you enter an incorrect coupon code that it just refreshes the page. What would need to be done in order to show an error message instead? Perhaps refresh the page but then show some bold red letters saying incorrect coupon code.

 

 

You're using a template, I gather, so keep in mind your code is now different from stock osCommerce code. I can only guess as to what exactly you need to add.

 

I typed up my instructions for doing this and added them to the README when I released that last version. Take a look in there.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Coca-Cola 12 packs $2.99 coupon, $3 delivery coupon, $.99 per lb ground beef limit 3 lbs. etc. etc.

 

Many people cut and use coupons with groceries all the time. I want to do the same. (My Site is a grocery store with local home delivery (no shipping) so I sort of compete with the local grocery stores.

 

 

It would be possible, and shouldn't require a huge change. I can tell you the places you'd need to make that change:

 

includes/classes/discount_coupon.php

includes/classes/order.php

checkout_payment.php

checkout_confirmation.php

 

Internally, the discount is calculated for each item and stored, so it's not a stretch to simply do this for more than one coupon. What's missing is the ability to enter more than one coupon. I don't really have the time to help you out on this though. If you find someone to help you, I am available to answer specific questions.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Any suggestions how to fix the double discount problem, being mentioned couple of pages ago?

 

 

Double-check includes/classes/order.php. That is where the discount is truly being applied to the order totals. If you have any other contributions that affected that file, then that is a possible problem. Run a compare program on the order.php you have and the order.php included in the DCC install zip.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

It would be possible, and shouldn't require a huge change. I can tell you the places you'd need to make that change:

 

includes/classes/discount_coupon.php

includes/classes/order.php

checkout_payment.php

checkout_confirmation.php

 

Internally, the discount is calculated for each item and stored, so it's not a stretch to simply do this for more than one coupon. What's missing is the ability to enter more than one coupon. I don't really have the time to help you out on this though. If you find someone to help you, I am available to answer specific questions.

 

 

This is all I need to get started, thanks for the point in the right direction. I'll post back my changes once done.

 

Thanks Again for the great contribution.

Link to comment
Share on other sites

Hello, I just installed this contribution the other day and I ran in to a little problem. For some reason, I can enter the coupon code on checkout_payment.php but nothing shows up on checkout_confirmation.php - not the coupon item, nothing calculated in to the sub total, or anything. Can you please direct me to the file that this information is generated from to try and figure out if I missed adding something during the install?

 

Thanks!

Link to comment
Share on other sites

Hello, I just installed this contribution the other day and I ran in to a little problem. For some reason, I can enter the coupon code on checkout_payment.php but nothing shows up on checkout_confirmation.php - not the coupon item, nothing calculated in to the sub total, or anything. Can you please direct me to the file that this information is generated from to try and figure out if I missed adding something during the install?

 

Thanks!

 

 

The discount is actually applied in includes/classes/order.php. Compare the version of that file you have with the version in the installation zip. You can take a look at the README file in the install zip for instructions on how to turn on and use debugging.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Everything seems to be working properly. I have not encountered any issues with the coupon yet except after I have installed the module I cannot access my admin interface. Everytime I try to get to the admin interface I get a error 404 page cannot be displayed.

 

This might have been answered but 72 pages is a lot to sift through! Thanks for any help!

Link to comment
Share on other sites

Just wanted to say that this is an amazing contrib. It works flawlessly and was very easy to install, even with other contribs vying for code space. If anyone wants to see it work, and buy something from my site, you can see it in live action! www.skinsgameclothing.com type in shopskins at checkout and get 15% off your order.

Link to comment
Share on other sites

Hi I have installed this contribution but I am having some problems!

 

In the admin area it all works fine and i can create coupons. The problem is that i have installed the fast checkout contrib so people dont need to creat an account or enter shipping info.

 

from the create account page my cart goes straight to checkout_shipping missing out the checkout_payment page. I have put the code in checkout_shipping for the coupon box and that displays fine, however when you go through to checkout_confirmation the discount is not applied. I have tried going back to the normal checkout procedure but that didnt work either. The contents of the coupon box isnt been recognised and passed through so the discount isn't been applied.

 

not sure if i've explained that very well but, any help would be very greatfully received!

 

Thanks

 

Rachael

Link to comment
Share on other sites

Hello,

 

I'm getting 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 'or z2g.zone_id = 0 or z2g.zone_id IS NULL )

 

SELECT dc2z.geo_zone_id FROM discount_coupons_to_zones dc2z LEFT JOIN zones_to_geo_zones z2g USING( geo_zone_id ) WHERE ( z2g.zone_id= or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id= or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="FFA9YG"

 

I'm using MySQL v4. Is there a way to get around this? Or do I have to upgrade to v5?

 

 

Thanks

Link to comment
Share on other sites

I can't get the % off shipping to work. No matter if its 10%, 50% or 100% off shipping, PayPal always returns with error 10520: This transaction cannot be processed. Please review the totals of this transaction and resubmit.

 

Any ideas? I'm at a loss.

 

Discount Coupon Codes 3.3

PayPal Direct Payment contribution

PayPal Website Payments Pro

 

Thanks

Link to comment
Share on other sites

Discount dependent on shipping module.

 

Would it be possible to apply the discount just on a particular shipping module? Or, exclude a particular shipping module from discount. I don't use shipping zones.

 

A possible solution could be inserting an IF function in the checkout_payment.php file for example.

Not sure whether it's that easy or any impacts to that, but your suggestions are welcome.

 

Example:

active shipping module 1: UPS - 10.00

active shipping module 2: DHL - 10.00

active shipping module 3: UPS express - 20.00

 

The discount should only be applied to module 1 or 2. If customer chooses for shipping option 3 no discount should be applied.

 

Another scenario would be that if shipping discount is setup (100%) then for shipping module 1+2 the shipping fee becomes 0.

However, if customer chooses module 3 then 10.00 discount is applied.

 

Can either of the two scenarios be covered in this discount module (e.g. using IF function)?

If so, I would appreciate your input it's not ideal, but I don't mind to hard code anything in the files rather then to have a nice front end in admin. As long as I can cover this.).

 

thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...