Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

I have installed 3.3 and cannot get past the checkout_payment.php page. I keep getting the error: The coupon code you have entered is not valid. I have checked and double checked. It is in the database, I am typing it correctly, but for some reason, it is kicking it out. Does anyone else have this problem? Any ideas?

Link to comment
Share on other sites

For people continuing to experience the following error message in their admin:

 

Cannot redeclare class ot_discount_coupon in .../includes/modules/order_total/ot_discount_coupon.php

 

The problem in my case came from the automatic installation of the SQL tables failing because they had already been created. I edited out the code under the install function and the installation worked with no errors.

Link to comment
Share on other sites

Has anyone ever figured out how to code the discount coupon box on the shopping_cart.php page where it actually works?

 

I have Google Checkout installed and I need people to type in their coupon code and then hit the GC button...but Google won't pick it up. And if a customer enters their code in the shopping cart first and then proceeds thru normal checkout...it won't take until they actually enter it and hit Confirm on the checkout_payment screen.

 

All I'm doing is copying and pasting what's been added to checkout_payment for the box into shopping_cart.php It looks great...just doesn't work. Is there something else I need to do?

 

Andrea

Link to comment
Share on other sites

Hi, I am desperately hoping that one of you might be able to help me!

 

I have installed the Discount Coupons. The admin side seems to all work fine, even when I go to the shop and try to use a coupon code, it appears that works fine, and it says "Congratulations, you have redeemed". But , the discount isn't applied, and doesn't show up on the total.

 

I have been struggling with this for several days now, and I have double checked that I have followed all of the instructions carefully, including making sure that I have a unique sort order for the order total module.

 

Could please anyone let me know what to do?

 

Thanks so much

Link to comment
Share on other sites

Hi, I am desperately hoping that one of you might be able to help me!

 

I have installed the Discount Coupons. The admin side seems to all work fine, even when I go to the shop and try to use a coupon code, it appears that works fine, and it says "Congratulations, you have redeemed". But , the discount isn't applied, and doesn't show up on the total.

 

I have been struggling with this for several days now, and I have double checked that I have followed all of the instructions carefully, including making sure that I have a unique sort order for the order total module.

 

Could please anyone let me know what to do?

 

Thanks so much

 

Hi Ifan, I was wondering what other contribs you have installed which might be effecting this one?

 

Also, I think I saw a while back that someone was having an issue with the coupon reducing the taxed amount besides taking the fixed amount off, but I can't seem to find it now. I could have sworn that this working properly for me and now it is definitely not. If anyone has any clue for me please let me know.

Link to comment
Share on other sites

I have an issue with the coupon being applied when it shouldn;t be. I have a clean install of osCommerce that I am putting this on. I set the order total minimum at 299, but when I order a product for 199, it still allows me to use the coupon. Did I miss something?

Link to comment
Share on other sites

I have an issue with the coupon being applied when it shouldn;t be. I have a clean install of osCommerce that I am putting this on. I set the order total minimum at 299, but when I order a product for 199, it still allows me to use the coupon. Did I miss something?

 

 

Never mind, I found out the issue.

Link to comment
Share on other sites

Hey guys,

 

I added the coupon code module to my store and it works fine, but now when a customer completes an order I no longer receive an order email. What should I do, Please help

 

Same problem as lmd06e.

 

After installing v3.31 with all the additional fixes, when a new order is placed, I no longer receive new order emails. Any ideas?

Link to comment
Share on other sites

hello...

Have spent quite some time installing this contribution, and it looks like it has the functions that i need..

I have jsut finished uploading and editing the files mentioned, but i must have med a mitake somewhere..

Can anybody help me out by showing what file i have to check trhough?

 

The problem is when the customer goes from "My cart" to "Check-Out".. Check-out is simply blank..

Any ideas on what is wrong?

 

 

Thanks in advance :-D

Edited by firben
Link to comment
Share on other sites

hello...

Have spent quite some time installing this contribution, and it looks like it has the functions that i need..

I have jsut finished uploading and editing the files mentioned, but i must have med a mitake somewhere..

Can anybody help me out by showing what file i have to check trhough?

 

The problem is when the customer goes from "My cart" to "Check-Out".. Check-out is simply blank..

Any ideas on what is wrong?

Thanks in advance :-D

 

Allright fixed this one...

now my admin is all messed up..

the boxes to the left are allright, but the main part of admin side is all blank..

any ideas on what to look at?

admin.png

Edited by firben
Link to comment
Share on other sites

HELP ME PLEASE!

 

 

allright..

i'll stop messing the whole thing up now..

it seems as if i make the same mistake all the time..

can't get to the checkout_shipping.php

 

what could be wrong??

Link to comment
Share on other sites

You misunderstand. There is code in the file, but when you go to that page with a web browser, it is totally blank. I suspec that there may be a problem with php5 compatibility

 

Did you ever figure this out? I'm running into the same problem now.

 

Thanks for any guidance.

-Brian

Link to comment
Share on other sites

I am using OSC 2.2 RC2a, PHP4, MYSQL.

 

I am getting the following error when someone enters a coupon code:

 

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="CouponCode"

[TEP STOP]

 

The coupon code displayed here I edited so nothing bad happens once I get this fixed.

 

Any ideas ??

Link to comment
Share on other sites

Okay,

 

Server Information

Server Host: () Database Host: MYSQLHOST (66.244.251.60)

Server OS: Database: MySQL 5.0.24a-log

Server Date: 03/30/2008 05:06:38 Datebase Date: 03/30/2008 05:06:38

Server Up Time:

HTTP Server: Apache/1.3.34 (Unix) mod_fastcgi/2.4.2 mod_perl/1.26

PHP Version: 4.4.7 (Zend: 1.3.0)

[osCommerce Online Merchant v2.2 RC2a]

osCommerce Online Merchant v2.2 RC2a

PHP Logo

PHP Version 4.4.7

 

System FreeBSD cgi25 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #4: Wed Sep 19 10:18:56 EDT 2007 root@admn6:/usr/obj/usr/src/sys/NF_GENERIC_MDROOT amd64

Build Date Mar 16 2008 15:56:54

 

It looks like the 1064 error is a problem with the DATABASE tables. Because I have 2 tax zones already setup. So what I don't see if which field is causing the error in the previous post.

 

Anyone who could suggest a possibility?

Link to comment
Share on other sites

Okay its not the tables the geo_zone_id is not getting passed to the query???

 

Now I just need to find which query that is???

 

Any help will be appreciated..

 

 

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="CouponCode"

 

[TEP STOP]

Link to comment
Share on other sites

Okay narrowed it down to includes/classes/order.php

 

to this piece of code:

 

 

//shipping zone exclusions
	$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 ) . '"' );

 

Now I need to find where $delivery is defined as an array having zone_id, country_id of the customer...

 

Okay... I'll find it...myself...

Edited by tapuahk
Link to comment
Share on other sites

Okay, duh, could I be that stupid... The problem may be that the $delivery array does not get filled if they choose digital products. So of course you have nulls being output.

 

How do I get it to pass billing address as delivery address???

 

Again I just need someone to show me how to get it to pass the shipping info normally sent when the user visits checkout_shipping.php

 

Any ideas??

Link to comment
Share on other sites

PSS, I tested it to make sure: I put two items in cart one digital and one physical. Got to checkout_shipping shipping address was blank. Chose 'Change Address' click radio button next to billing address, choose shipping method for physical item, chose 'continue' and Got to payment enter coupon code hit continue, COUPON worked and Displayed on Confirmation screen

 

So I need to change the behavior of digital products to not skip shipping info. Any ideas.???

Link to comment
Share on other sites

I am having a serious problem after installing this contribution. I hope that you guys can help me.

 

I am using paypal ipn, and when returning from the paypal payment page to checkout_process.php I get this error:

 

Parse error: syntax error, unexpected T_STRING in /home/shopdom/public_html/includes/languages/espanol/checkout_process.php on line 16

 

No confirmation email is sent and the shopping cart retains the paid items.

 

Any idea how to solve this? I will really appreciate it.

 

 

Hello,

 

I have the same problem (No confirmation email is sent and the shopping cart retains the paid items).

 

So I decided to replace the file chekout_process.php by an other file who is not modified. And everything is OK. But the contribution with Discount coupon code doesn't work, Normal !!!!!!

 

In the file checkout_process.php, for the contribution with Discount coupon, I modified that:

 

 

FIND on line 108:

 

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

$sql_data_array = array('orders_id' => $insert_id,

'orders_status_id' => $order->info['order_status'],

'date_added' => 'now()',

'customer_notified' => $customer_notification,

'comments' => $order->info['comments']);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

 

ADD this code after:

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) {

$sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'],

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

 

 

 

FIND on line 278:

 

// unregister session variables used during checkout

tep_session_unregister('sendto');

tep_session_unregister('billto');

tep_session_unregister('shipping');

tep_session_unregister('payment');

tep_session_unregister('comments');

 

 

ADD this code after:

 

//kgt - discount coupons

tep_session_unregister('coupon');

//end kgt - discount coupons

 

Could somebody help me? Thank you.

 

Guillaume.

Link to comment
Share on other sites

Ok, I have looked through a ton of pages and I haven't seen anyone else with this issue.

 

I am having a problem where I keep getting redirected to the login page when I use some of my coupon codes. 1 of the coupons I have set up works fine and takes you to the confirmation page as it should. For all the rest of the coupons this is what happens:

- customer adds something to cart

- customer clicks checkout and is taken to the login page

- customer logs in and is taken to checkout_shipping

- customer clicks continue and is taken to checkout_payment

- customer chooses payment type and enters coupon code

- when they click continue they are logged off and taken back to the login page. no errors are given.

 

the same thing happens if i enter an incorrect coupon code. i have checked to make sure that the coupons are all in the database.

 

any suggestions?

 

Okay, weird as it may sound, it appears you have a browser cookie problem...

 

In your configure.php make sure your cookie domain(s) (especially the SSL one) matches your actual domain(s).

 

If the cookie get stored the wrong place your users will get treated like a crawler and dump the cart if you try to checkout.

 

~~~Tapuahk

Link to comment
Share on other sites

So this is my first post, and I probably had no business messing with my tables, but I did... and miraculously it worked.

 

For those of you getting this error in admin:

Discount Coupons

1054 - Unknown column 'cd.date_end' in 'order clause'

 

select * from discount_coupons cd order by cd.date_end, date_start limit 0, 20

 

[TEP STOP]

 

 

I just fixed it by going into my discount_coupons table and adding coupons_ in front of date_start and date_end

 

At first this didn't work because there must have been a pre-existing space in front of each table name! I took that space out and it works!!!

Link to comment
Share on other sites

I am able to input the information for the coupons, and if don't enter something (an amount, for example), it will remind me to do so. But then, upon hitting submit, I get:

 

1136 - Column count doesn't match value count at row 1

 

insert into discount_coupons values ( 'test', '', '5', 'fixed', null, null, 0, 0, null, 0)

 

[TEP STOP]

 

 

 

Ok, so perhaps I picked up the wrong SQL, but there was never any SQL info on the contribution itself. So, what IS the SQL command?

Link to comment
Share on other sites

I am able to input the information for the coupons, and if don't enter something (an amount, for example), it will remind me to do so. But then, upon hitting submit, I get:

 

1136 - Column count doesn't match value count at row 1

 

insert into discount_coupons values ( 'test', '', '5', 'fixed', null, null, 0, 0, null, 0)

 

[TEP STOP]

Ok, so perhaps I picked up the wrong SQL, but there was never any SQL info on the contribution itself. So, what IS the SQL command?

 

Hi, I am not sure if I installed the same exact contrib, but mine has this in the instructions:

 

The module will automatically create the database tables needed, there is no SQL script you need to run, unless the script encountered an error creating the tables (this can happen if the user osCommerce connects with does not have CREATE TABLE permissions). See the common problems section if you need to manually run the create table statements.

 

Then down in the problem section it has:

 

# Creating the database tables failed, and I need the SQL statements.

Here you go:

 

CREATE TABLE IF NOT EXISTS discount_coupons (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

coupons_description VARCHAR(64) NOT NULL DEFAULT '',

coupons_discount_amount DECIMAL(15,12) NOT NULL DEFAULT '0.0000',

coupons_discount_type ENUM ('fixed','percent','shipping') NOT NULL DEFAULT 'percent',

coupons_date_start DATETIME DEFAULT NULL,

coupons_date_end DATETIME DEFAULT NULL,

coupons_max_use INT(3) NOT NULL DEFAULT 0,

coupons_min_order DECIMAL(15,4) NOT NULL DEFAULT '0.0000',

coupons_min_order_type ENUM('price','quantity') DEFAULT 'price',

coupons_number_available INT(3) NOT NULL DEFAULT 0,

PRIMARY KEY (coupons_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_orders (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

orders_id INT(11) DEFAULT '0',

PRIMARY KEY (coupons_id,orders_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_categories (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

categories_id INT(11) NOT NULL DEFAULT '0',

PRIMARY KEY (coupons_id,categories_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_products (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

products_id INT(11) NOT NULL DEFAULT '0',

PRIMARY KEY (coupons_id,products_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_manufacturers (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

manufacturers_id INT(11) NOT NULL DEFAULT '0',

PRIMARY KEY (coupons_id,manufacturers_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_customers (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

customers_id INT(11) NOT NULL DEFAULT '0',

PRIMARY KEY (coupons_id,customers_id)

);

 

CREATE TABLE IF NOT EXISTS discount_coupons_to_zones (

coupons_id VARCHAR(32) NOT NULL DEFAULT '',

geo_zone_id INT(11) NOT NULL DEFAULT '0',

PRIMARY KEY (coupons_id,geo_zone_id)

);

 

 

Hope that helps!

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...