OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Discount Coupon Contribution and downloadable porducts
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Order Total Modules
eyeconect
I am using Discount Coupon Code - http://www.oscommerce.com/community/contributions,4269

My customer now have products that are downloadable.

If the only products in the cart is downloadable, delivery address is bypassed, Hence discount coupon fails to finish calculation.

We get Following message and the checkout process stops.

*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 jor_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="somecouponcode"

[TEP STOP]

So, as I am about to fix this, Just checking if anyone has fixed this already.

Looking forward to any reply.

Regards.
barnasoft
I have exacly the same problem, don't know where is the problem.

I am looking for it

Thanks!
jonkopp
anybody got any thoughts on this?

I need help! smile.gif
eyeconect
QUOTE (jonkopp @ Oct 4 2007, 04:48 AM) *
anybody got any thoughts on this?

I need help! smile.gif



Here is what fixed the problem on my site.

Basically, the fix is to check if zone_id is set . if set continue else skip this part.

On file catelog/include/classes/discount_coupon.php . version:
/*
* discount_coupon.php
* August 4, 2006
* author: Kristen G. Thorson
* ot_discount_coupon_codes version 3.0
*
*
* Released under the GNU General Public License
*
*/

----------------------------- Starts at around line 68
//shipping zone exclusions
if($delivery['zone_id'] != '' && $delivery['country_id'] != '') // Added by eyeconect to fix for downloadable only in cart.
{
.... no changes below
$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 ).'"' );
if (tep_db_num_rows( $check_user_query ) > 0 ) {
$this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //display the error message
//use this to debug exclusions:
//$this->message( 'Shipping Zones exclusion check failed' );
}
..... no changes above
//end shipping zone exclusions
}//end of if delivery array is set. By EyeConect.


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

Best Regards.
chrisarr
You are a hero EyeConect!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.