Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Hi there,

 

I've just installed this great contrib but when I've come to test it - my discount code is generating the message:

 

"The minimum order total for this coupon is £20.00. Some or all of the products in your cart are excluded."

 

 

Now I've read some of the other posts with regards to this and it seems people had exclusions within the discount rules.. but I've just checked on mine and there are absolutely none featured! Just wondering then if anyone has any clues/advice on how to resolve this issue?

 

Edit: And just to clarify, the basket total is currently £79.96 and this 5% discount should be applicable to any conditions

 

Thanks,

 

Lee

Edited by leelee2023
Link to comment
Share on other sites

Hi All,

 

I 'm using a contribution Discount Coupon Codes...Everything seem fine but when I click on the admin there an error that show

Fatal error: Cannot redeclare class currencies in /home/sherrlim/public_html/admin/includes/classes/currencies.php on line 16

 

Can anyone help...

Thanks in advance!

Link to comment
Share on other sites

Hello,

 

I've found the post: http://www.oscommerce.com/forums/topic/213019-contribution-discount-coupon-codes/page__view__findpost__p__1066304 where mbrailer explain a problem i have as well, max/available uses is not updated after a coupon is used:

 

Change this block of code to this and see if that fixes it:

 

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

 

 

On my case, discount_coupons_to_orders table is empty, what could be the cause here, please?

 

Any advice greatly welcome, due i'm totally lost on what to try.

 

 

Thanks in advance,

Best Regards.

Link to comment
Share on other sites

BTW, regarding my above problem, may i've found the problem but i need your advice cause i'm not sure.

 

The following code (from checkout_process.php):

 

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

 

Shouldn't it be added to the payment module as well?, in my case to ~/modules/payment/paypal_ipn/ipn.php (???)

 

btw, if it matters, my shop only has downloadable goods.

Link to comment
Share on other sites

I have a coupon set for a minimum price for $125.

The coupon excludes almost anything below $125, but I did find an instance where it is discounting the 10% for an order of 119.85 (before shipping).

 

Debug output shows this as well:

[coupon] => discount_coupon Object

(

[messages] => Array

(

[debug] => Array

(

[0] => INFO: DISPLAY_PRICE_WITH_TAX = false

[1] => INFO: MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING = false

[2] => INFO: MODULE_SHIPPING_TABLE_STATUS = False

[3] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS = true

[4] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_SORT_ORDER = 0

[5] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TYPE = true

[6] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL = true

[7] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_TAX = None

[8] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_EXCLUDE_SPECIALS = false

[9] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_RANDOM_CODE_LENGTH = 6

[10] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_LINES = false

[11] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_ALLOW_NEGATIVE = false

[12] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_USE_LANGUAGE_FILE = false

[13] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_CONFIG = Discount Coupon

 applied

[14] => INFO: MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG = true

[b][15] => INFO: Product 1464 passed exclusion check. Discount 11.985 applied. (percent)

[16] => INFO: Discount of 11.985 applied to product 1464 ($119.85).

[17] => INFO: Calculating tax on 107.865. Displayed price 107.865.[/b]

)

 

)

 

[coupon] => Array

(

[coupons_id] => DFXJQW

[coupons_description] => description of coupon

[coupons_discount_amount] => 0.100000000000

[coupons_discount_type] => percent

[coupons_date_start] => 2010-01-11 00:00:00

[coupons_date_end] => 2010-02-20 00:00:00

[coupons_max_use] => 1

[b][coupons_min_order] => 125.0000

[coupons_min_order_type] => price[/b]

[coupons_number_available] => 10000

 

Can anyone point me to where in the code this bug might be fixable or help in any way? This is quite urgent.

Thank you!

Edited by lnewmark
Link to comment
Share on other sites

Wonderful contribution, and by the looks of the updates, etc..., your continued work is remarkable.

 

My installation was smooth and simple. I found one misprint in my own work that was causing a error on the admin pages, but fixed that with a simple re-paste.

 

I have a problem on the admin->catalog->discount coupons page. The "Button_New_Coupon.gif" is not present, and with that, I cannot add a coupon to test the completed installation.

 

I have looked for the code that presents the "button" on the admin/includes/coupons.php, and found the code for that command, but that is as deep as I know how to dig.

 

What could I send you to help?

 

Thank you.

Link to comment
Share on other sites

In checkout_payment.php i need to apply diferent coupon boxes.

 

On top a Distributor Code, for special clients (some like SPPC).

 

And bottom the Discount Coupon box code.

 

I have tried it and only one works for the form. Im thinking on duplicate the ot_discount_coupon.php to ot_discount_coupon2.php and edit it as new one for using both.

 

Can anyone help me how to do it??

Link to comment
Share on other sites

After loading and editing, the coupon works but like the poster at the beginning said, it is doubling the item amount. If the item costs $10.00, it shows the coupon discount (lets say -$2.00) and then the subtotal says $18.00.

 

I did get one suggestion but it is still doing it. Does anyone have any thoughts on this? I would love to use this contribution but cannot at this point.

 

Thanks,

Kelly

Link to comment
Share on other sites

Hi, I have an oscommerce ms 2.2 e-commerce site - I have used the AutoInstaller 2.14 for Discount Coupon Codes and have installed the Discount Coupon Codes v 3.32 - Everything seems to work okay, however I have discovered that if during the order process (Payment Information - checkout_payment.php), if customers types in an incorrect Coupon Code in the box, after clicking on Continue, they will be taken to the login page (login.php) - this is like a loop process. However if they type in the right coupon code, everything works fine and the discount is applied ... Any idea what is causing this?

 

I'm running PHP 5.2.6 - MySQL 4.1.22-standard

 

Thanks for your help in advance.

 

P.S. what would be the latest / correct version of Discount Coupon Codes to use for an oscommerce ms 2.2 shopping cart? is version v 3.32 correct?

 

Thanks.

Link to comment
Share on other sites

I'm getting a fatal error on checkout_confirmation.php

 

Fatal error: Session variable coupon is not globally defined

 

Looks like it's caused by:

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');

 

I have register globals off. Can anyone help? Thanks.

Link to comment
Share on other sites

Does the error message show up after they are redirected to login?

 

Can you post the code on your checkout_payment.php page - everything above the </head><body> tags?

 

Hi, I have an oscommerce ms 2.2 e-commerce site - I have used the AutoInstaller 2.14 for Discount Coupon Codes and have installed the Discount Coupon Codes v 3.32 - Everything seems to work okay, however I have discovered that if during the order process (Payment Information - checkout_payment.php), if customers types in an incorrect Coupon Code in the box, after clicking on Continue, they will be taken to the login page (login.php) - this is like a loop process. However if they type in the right coupon code, everything works fine and the discount is applied ... Any idea what is causing this?

 

I'm running PHP 5.2.6 - MySQL 4.1.22-standard

 

Thanks for your help in advance.

 

P.S. what would be the latest / correct version of Discount Coupon Codes to use for an oscommerce ms 2.2 shopping cart? is version v 3.32 correct?

 

Thanks.

~Tracy
 

Link to comment
Share on other sites

This is where I have my coupon check code on checkout_confirmation.php

 if (!tep_session_is_registered('comments')) tep_session_register('comments');
 if (tep_not_null($HTTP_POST_VARS['comments'])) {
   $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
 }

// BOF Discount Coupons
 if (!tep_session_is_registered('coupon')) tep_session_register('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']);
// EOF Discount Coupons

 

The next bit of DCC code happens here:

 if (is_array($payment_modules->modules)) {
   $payment_modules->pre_confirmation_check();
 }


//BOF Discount Coupons
 if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
   $order->coupon->verify_code();
   if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
	  if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
		  if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
	  } else {
		  if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
		  	tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
			  }
   }
} else { //if the coupon field is empty, unregister the coupon from the session
	if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
     tep_session_unregister('coupon');
     //now check to see if we need to recalculate shipping:
     require_once( DIR_WS_CLASSES.'discount_coupon.php' );
     if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
  }
   }
//EOF Discount Coupons


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

 

Is that how yours looks?

 

I'm getting a fatal error on checkout_confirmation.php

 

Fatal error: Session variable coupon is not globally defined

 

Looks like it's caused by:

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');

 

I have register globals off. Can anyone help? Thanks.

~Tracy
 

Link to comment
Share on other sites

I don't know if anyone else ran into this problem. After installing this add on, I'm having an issue with members logging out of my main site. When they click on log out on the php fox portion of my site (www.dizzspace.com) they are redirected to my shop (www.dizzspace.com/shop) log out and they remain logged into the site. Instead of the url stating (www.dizzspace.com/logout) it reads (http://www.dizzspace.com/shop/logoff.php?return=http://www.dizzspace.com/logout/osc_true/) . Anyone have any ideas on how to fix this?

Link to comment
Share on other sites

Hi all :)

 

Thanks for that contrib that sounds great but i have a small problem with my installation... Everything seems to be well set up, the coupon query is available on the customers side, but in the admin, when i go to Catalog / Discount Coupon, i just see the:

 

TEXT_DISCOUNT_COUPONS_ID  	TEXT_INFO_DISCOUNT_AMOUNT  	TEXT_INFO_DATE_START  	TEXT_INFO_DATE_END  	TEXT_INFO_MAX_USE  	TEXT_INFO_MI

in the grey line under the title... I've checked my sql, here are the tables i can see:

 

- discount coupons

- discount coupons to categories

- discount coupons to customers

- discount coupons to orders

- discount coupons to products

- discount coupons to zone.

 

I have OSCommerce 2.2RC1, my server is running Php 5.2.11. My Discount Coupon is the 3.4 version, with the spanish translation (even if i haven't set up the spanish language).

 

Thanks in advance for your support :)

Link to comment
Share on other sites

Looks to me like you need to make the updates to your languages file on the admin side. It doesn't know what text to put there yet.

 

Hi all :)

 

Thanks for that contrib that sounds great but i have a small problem with my installation... Everything seems to be well set up, the coupon query is available on the customers side, but in the admin, when i go to Catalog / Discount Coupon, i just see the:

 

TEXT_DISCOUNT_COUPONS_ID  	TEXT_INFO_DISCOUNT_AMOUNT  	TEXT_INFO_DATE_START  	TEXT_INFO_DATE_END  	TEXT_INFO_MAX_USE  	TEXT_INFO_MI

in the grey line under the title... I've checked my sql, here are the tables i can see:

 

- discount coupons

- discount coupons to categories

- discount coupons to customers

- discount coupons to orders

- discount coupons to products

- discount coupons to zone.

 

I have OSCommerce 2.2RC1, my server is running Php 5.2.11. My Discount Coupon is the 3.4 version, with the spanish translation (even if i haven't set up the spanish language).

 

Thanks in advance for your support :)

~Tracy
 

Link to comment
Share on other sites

Hi,

Can someone please help? I have this contribution up and running great - so I thought.

 

My invoices all show the correct discount applied. However, the discount is not getting passed through to paypal IPN so the customer is being asked to pay for the order without the discount applied.

 

These are my code settings

Enable discount coupon?

true

 

Sort Order

0

 

Display discount with minus (-) sign?

true

 

Display subtotal with applied discount?

true

 

Display tax in discount line?

None

 

Exclude product specials?

true

 

Random Code Length

6

 

Display discount total lines for each tax group?

false

 

Allow negative order total?

false

 

Use the language file to format display string?

false

 

Display Format for Order Total Line

Discount Coupon

 applied

 

Debug Mode

false

 

Urgent help would be really appreciated as Im having to provide manual refunds of the discount.

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

OK,

 

Sorted it now - in Paypal IPN the setting must be "aggregate"

 

Now it works

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

hi

 

i am using the PayPal Website Payments Standard payment module. Rc2.2a version with the latest Discount Coupon Codes installed at this time. Everything is working perfect, only the PayPal page the discount is not applied. Even when the payment is done the order email send the discount but not on PayPal.

Any advice?

thanks

Link to comment
Share on other sites

Hi

 

I've installed the contrib (3.34, 9th July) and it seems to work but when I'm at checkout_confirmation and navigate away to change the postage, I have to retype the discount code in again. If I go to the shopping cart (Edit Items link)from checkout_confirmation, change nothing then pick "continue shopping" the discount text disappears from the confirmation page.

 

I'm sure I've seen this bug mentioned but I can't find it or any solution.

 

Hope someone can help

 

Ian

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