Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Firstly, this contribution is exactly what I was looking for and everything was so easy to set up - well done and thank you!

 

Now, I need a little help - when completing checkout instead of seeing the checkout success page, I see this:

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in *******\includes\classes\email.php on line 520

Warning: Cannot modify header information - headers already sent by (output started at *******\includes\classes\email.php:520) in ******\includes\functions\general.php on line 33

 

I'm not sure where to start to fix this, my store is pretty well modified, I suspect the error is in general.php rather than email.php - but being a complete beginner I don't know where to start!

 

Any suggestions would be really appreciated - let me know if I need to post the code for each or either file.

 

 

This is a server problem:

 

http://www.google.com/search?hl=en&lr=...amp;btnG=Search

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Silly question time from me.

 

Do I need to install the original V2 verison and then the Bug fix version. The admin area is not in the bugfix zip.

 

Also can you have a non expirery discount code (i.e. be used as many times as wanted, by as many people as want to use it)

Link to comment
Share on other sites

I have just installed this contribution and think it well written. but i have a small problem. can anyone tell me how to fix it?

the issue is that i want my customers to use a fixed coupon as in say $20 is applied to all orders greater than $25 , but if order is less than $25 then coupon can not be applied.

i tried several ways to acheive this but it seems the coupon gets applied regardless of the order being less than $25 which results in an undesirable negative order total. any help or advise will be well apreciated.

Link to comment
Share on other sites

I installed this contrib today but I cannot see where I can add the coupon code when placing orders.

 

I have double and triple checked to make sure all the files have been edited and installed correctly. All the Admin side is working well, just the shop side.

 

I am using Fast Easy Checkout, is this compatible with the Discounts Contrib?

Link to comment
Share on other sites

Silly question time from me.

 

Do I need to install the original V2 verison and then the Bug fix version. The admin area is not in the bugfix zip.

 

Also can you have a non expirery discount code (i.e. be used as many times as wanted, by as many people as want to use it)

 

The bug fix is for version 2, so it means it's just a fix for version 2 release. So you need version 2 then apply the bugfix.

 

Coupons need not expire. Read the manual for more help on what the settings are. You can find it as a link from the top right corner of the coupons admin.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I have just installed this contribution and think it well written. but i have a small problem. can anyone tell me how to fix it?

the issue is that i want my customers to use a fixed coupon as in say $20 is applied to all orders greater than $25 , but if order is less than $25 then coupon can not be applied.

i tried several ways to acheive this but it seems the coupon gets applied regardless of the order being less than $25 which results in an undesirable negative order total. any help or advise will be well apreciated.

 

Make sure you have the bugfixes applied, and see this post:

 

http://www.oscommerce.com/forums/index.php?sho...019&st=260#

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Version 2.1 is up with compiled bugfixes and one new feature.

 

http://www.oscommerce.com/community/contributions,4269

 

Bug Fixes:

* Replaced tep_db_prepare_input() with tep_db_input() in includes/classes/discount_coupon.php to correctly sanitize string for database query.

* Max_use, min_order, number_available checks did not work with update to 2.0 because of a missing line.

* Error message for max_use would not display because it was not being saved as a object variable.

* Global currencies variable was not declared in function to check min_order so resulted in an error.

* If discount is more than min_order, do not allow applied discount to exceed the products price to prevent negative order totals.

* Unregister the coupon session variable when logging off.

 

Other changes:

* Added configuration option to select whether to use language files for order total line display or to use the module configuration field. This is needed for shops using multiple languages that wish to display the order total line formatted for each language.

 

Also, a report that works with the 2.* versions is up (also included with the 2.1 version).

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Anyone else getting

 

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

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit 0, 21

[TEP STOP]

 

I just tried upgrading? Am i missing some sql changes?

Link to comment
Share on other sites

Anyone else getting

 

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

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit 0, 21

[TEP STOP]

 

I just tried upgrading? Am i missing some sql changes?

 

 

I think maybe you missed upgrading to 2.0. 2.1 assumes you did the 2.0 upgrade.

 

You need to perform the following queries:

 

ALTER TABLE discount_coupons CHANGE date_start coupons_date_start DATETIME DEFAULT NULL;
ALTER TABLE discount_coupons CHANGE date_end coupons_date_end DATETIME DEFAULT NULL;
ALTER TABLE discount_coupons CHANGE max_use coupons_max_use INT(3) NOT NULL DEFAULT 0;
ALTER TABLE discount_coupons CHANGE max_order coupons_max_order DECIMAL(15,4) NOT NULL DEFAULT '0.0000';
ALTER TABLE discount_coupons CHANGE number_available coupons_number_available INT(3) DEFAULT 0 NOT NULL;
ALTER TABLE discount_coupons ADD COLUMN coupons_max_order DECIMAL(15,4)  DEFAULT '0.0000' NOT NULL AFTER coupons_min_order;

Also check you have version 2.0 already installed.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello,

I have installed the coupon report and everything seems to work properly except for 1 item. On the report page, "All coupons", I click on the % Discount, Global Number Available or Number Used columns to drill down into the report deeper. When that report page appears, the column for Customer Name is always empty.

 

Was the intent to have the name appear in this column? Please advise.

Link to comment
Share on other sites

Hi,

 

I've installed the contrib, but when I get to checkout_payment.php and click "Continue", the next page is blank. It's blank whether I enter a coupon or not. Also, I removed all coupons, and didn't enter one, still blank. The only way to fix my e-com is by disabling the module in the admin.

 

Any suggestions?

 

Thanks,

Mike

Link to comment
Share on other sites

Hi,

 

I've installed the contrib, but when I get to checkout_payment.php and click "Continue", the next page is blank. It's blank whether I enter a coupon or not. Also, I removed all coupons, and didn't enter one, still blank. The only way to fix my e-com is by disabling the module in the admin.

 

Any suggestions?

 

Thanks,

Mike

 

You've probably got a fatal error and your host has display_errors turned off. You can usually turn them on to find out what the error is by adding these two lines to the top of includes/application_top.php:

 

ini_set( 'error_reporting', 'on' );

ini_set( 'display_errors', 1 );

 

 

Once you know what the error is, it should give more information as to what the problem is.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello,

I have installed the coupon report and everything seems to work properly except for 1 item. On the report page, "All coupons", I click on the % Discount, Global Number Available or Number Used columns to drill down into the report deeper. When that report page appears, the column for Customer Name is always empty.

 

Was the intent to have the name appear in this column? Please advise.

 

The name should appear and as far as I know, it works.

 

You can try replacing

 

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, 'action=edit&oID=' . $coupons['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $coupons['customers_name']; ?></td>

with

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, 'action=edit&oID=' . $coupons['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . tep_customers_name($HTTP_GET_VARS['custID']); ?></td>

in admin/stats_discount_coupons.php on line 83.

 

If that doesn't work, then I'd need some more information.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Kristen,

 

I made the change as suggested and still saw no Customer Names. This made no sense as I now see where you were retrieving the data from. So, I looked into our tables and found the issue. We periodically dump older orders from the online tables due to volume. The coupon code I was using had not been used since this last dump and consequently, the orders did not exist to get the cus name from. I checked with some more recent customer orders and other discount codes and everything is working as it should.

 

Sorry for the false alarm.

Link to comment
Share on other sites

You're going to have to give more information, like the values of the other fields, a sample of your order confirmation totals (with the products prices and quantities included). It's just not possible to make a wild guess as to what the problem is.

 

the fix amount discount works fine, but the percentage discount is weird. it seems like it is always taking $600 as the subtotal, like if I enter a 15% off coupon, it will take $90 off and if I enter a 30% off coupon, it will take $180 off, no matter how much amount in the cart, what could be wrong? :(

slingcarrier dot com

Link to comment
Share on other sites

the fix amount discount works fine, but the percentage discount is weird. it seems like it is always taking $600 as the subtotal, like if I enter a 15% off coupon, it will take $90 off and if I enter a 30% off coupon, it will take $180 off, no matter how much amount in the cart, what could be wrong? :(

 

I know nothing about the mechanics of what's happening because you haven't provided any useful information. You're making a conjecture as to what's going wrong (order total is $600) but that may not be what's actually happening. It's kind of like saying, "well my car won't start so I must have run out of gas." There can be multiple (hidden) causes for one symptom so it's almost impossible to diagnose without more information.

 

At the very minimum, I will need to see a sample order with all the order totals. I will also need to know what entries you have in each and every field of the coupon (max use, min order, etc).

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hi KGT,

 

I added the code you mentioned and am getting this error:

 

Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/pathtodomain/httpdocs/products/checkout_confirmation.php on line 58

 

Here is part of what is on that page, not sure what to do now though. (i numbered the lines)

 

46		//kgt - discount coupons
47	  if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
48	  if (tep_not_null($HTTP_POST_VARS['coupon'])) {
49		  //this needs to be set before the order object is created, but we must process it after
50		$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
51	  }
52	  //end kgt - discount coupons
53
54
55   require(DIR_WS_CLASSES . 'order.php');
56  $order = new order;
57 
58  $payment_modules->update_status();

Link to comment
Share on other sites

I think maybe you missed upgrading to 2.0. 2.1 assumes you did the 2.0 upgrade.

 

You need to perform the following queries:

 

ALTER TABLE discount_coupons CHANGE date_start coupons_date_start DATETIME DEFAULT NULL;
ALTER TABLE discount_coupons CHANGE date_end coupons_date_end DATETIME DEFAULT NULL;
ALTER TABLE discount_coupons CHANGE max_use coupons_max_use INT(3) NOT NULL DEFAULT 0;
ALTER TABLE discount_coupons CHANGE max_order coupons_max_order DECIMAL(15,4) NOT NULL DEFAULT '0.0000';
ALTER TABLE discount_coupons CHANGE number_available coupons_number_available INT(3) DEFAULT 0 NOT NULL;
ALTER TABLE discount_coupons ADD COLUMN coupons_max_order DECIMAL(15,4)  DEFAULT '0.0000' NOT NULL AFTER coupons_min_order;

Also check you have version 2.0 already installed.

 

Attempting to run the SQL changes above in a 1.4 to 2.0 and I get the error that the 'date_start' colum does not exist. What am I missing?

Link to comment
Share on other sites

Hi KGT,

 

I added the code you mentioned and am getting this error:

 

Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/pathtodomain/httpdocs/products/checkout_confirmation.php on line 58

 

Here is part of what is on that page, not sure what to do now though. (i numbered the lines)

 

46		//kgt - discount coupons
47	  if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
48	  if (tep_not_null($HTTP_POST_VARS['coupon'])) {
49		  //this needs to be set before the order object is created, but we must process it after
50		$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
51	  }
52	  //end kgt - discount coupons
53
54
55   require(DIR_WS_CLASSES . 'order.php');
56  $order = new order;
57 
58  $payment_modules->update_status();

 

I think when you added the discount coupons code, you stepped over more than you should have. That same snippet should look like this:

 

//kgt - discount coupons
 if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
  //this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }
 //end kgt - discount coupons

// load the selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

 $payment_modules->update_status();

 

You're missing these lines:

 

// load the selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Thanks KGT, I appreciate the help. I fixed that file, but now getting this error:

 

 

Warning: main(/home/httpd/vhosts/pathtodomain/httpdocs/productsincludes/classes/discount_coupon.php): failed to open stream: No such file or directory in /home/httpd/vhosts/pathtodomain/httpdocs/products/includes/modules/order_total/ot_discount_coupon.php on line 14

 

Fatal error: main(): Failed opening required '/home/httpd/vhosts/pathtodomain/httpdocs/productsincludes/classes/discount_coupon.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/pathtodomain/httpdocs/products/includes/modules/order_total/ot_discount_coupon.php on line 14

 

I checked it out, and all the files are uploaded though.

 

Line 14 is:

 	require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );

 

But that file is there too.

 

Is there supposed to be no / (slash) between the "products" and "includes" dir in those errors above?

Edited by mltgroup
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...