Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

the same thing happend to me.. i'm using RC2a with 3.31 version of DCC...

 

any help pls?

 

oh my.. sorry.. well the 'fix' for this is very simple in my case...

i have change the value of button "save" for my language but not change the code this action.. i simply return for the original value and voilá..

Share this post


Link to post
Share on other sites

I've had this running for ages perfectly on PHP4.

 

Now that my Host is upgrading to PHP5, I've been doing some testing and found that when a Discount Coupon Code is entered during the checkout process, it appears to be completely ignored. The checkout confirmation page appears with the subtotals, but the Discount Code line is missing and the value isn't listed.

 

It seems specific to PHP5. Does anyone have any ideas?

Share this post


Link to post
Share on other sites
I've had this running for ages perfectly on PHP4.

 

Now that my Host is upgrading to PHP5, I've been doing some testing and found that when a Discount Coupon Code is entered during the checkout process, it appears to be completely ignored. The checkout confirmation page appears with the subtotals, but the Discount Code line is missing and the value isn't listed.

 

It seems specific to PHP5. Does anyone have any ideas?

 

 

Adding to this, if I go back to the page where the Discount Code is entered, it doesn't appear (but other fields like Comments are retained). It's as though the entry is being completely ignored. I have Fast Easy Checkout (FEC) installed too and don't know if it's conflicting, but it was working perfectly up until I switched over to testing with PHP5.

Share this post


Link to post
Share on other sites

Hey Everyone,

I have decided to install this contribution, but I am running into few problems.

First off, after I copied the files, and created tables.

I went to Modules>Order Total and enabled the module. HOWEVER:

I do not see Discount Coupons in Catalog. I double and triple checked to make sure that I uploaded the file. Im lost :(

 

I am assuming that is why I am getting the following error during checkout:

 

1146 - Table 'pethouse_osc1.TABLE_DISCOUNT_COUPONS' doesn't exist

 

SELECT dc.* FROM TABLE_DISCOUNT_COUPONS dc WHERE coupons_id = 'test' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

And lastly...my checout confirmation page got screwed up after the update. I have a wide column in the middle and teh details of the checkout are squeezed on the side. Have I messed up the table? How can I correct it. Thank You all in advance....

M.

Share this post


Link to post
Share on other sites

Hi,

 

I am not sure on your checkout page being changed, but I think you missed adding the following to your includes/database_tables.php file:

 

//kgt - discount coupons

define('TABLE_DISCOUNT_COUPONS', 'discount_coupons');

define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders');

//end kgt - discount coupons

 

I believe this may be giving you the error message.

Share this post


Link to post
Share on other sites

Hi,

 

I am having trouble doing something very basic! I have modified the contribution to work as a VAT Exemption system. This all works great so far.

 

However, I need to change the text "Discount Coupon

 applied" in the Checkout Confirmation.   I've looked through loads of code and have found two entries relating to what I think I need in "includes/languages/english/modules/order_total/ot_discount_coupon.php" and "includes/modules/order_total/ot_discount_coupon.php".

 

I have changed the entries from "Discount Coupon [code] applied "to Vat Exemption [code] applied" and uploaded the two files, but it just isn't working. "It still says Discount Coupon [Code] applied" in checkout confirmation.

 

I know it's something simple, but I really can't find it. Any help would be great!

 

Thanks!

Share this post


Link to post
Share on other sites

Hi,

 

I try to look up the error that shows up when I click on the Admin > Catalog > Discount Coupons. I found there was a solution which is located in an already broken link.

 

Please help me to fix this 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 '-20, 20' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -20, 20

 

 

Thank you so much in advance!

Share this post


Link to post
Share on other sites

Hoping somebody here has some ideas. I am trying to manually upgrade our store from 060817 to rc2 - at the moment I have done the steps for the manual upgrade to rc1 and I'm having a problem with the function is_recalc_shipping I am hoping to get this working before then doing the manual upgrading to rc2 (hopefully I won't need to re-do this function again for rc2 - LOL).

 

I have had to modify this function quite a bit as I have SPPC installed and our shipping files change based on which customer group a customer is logged in under. So - for example, a retail customer will have MODULE_SHIPPING_FREEAMOUNT_STATUS = 'True" whereas a wholesale customer will have MODULE_SHIPPING_WFREEAMOUNT_STATUS = 'True". The same goes for the TABLE and WTABLE (and I do have files for both freeamount.php and wfreeamount.php as well as table.php and wtable.php).

 

Therefore - I had to make some modifications to the includes/classes/discount_coupon.php file which now looks like this:

	function is_recalc_shipping() {
  global $order, $language;

  //calculate the order total:
  $order_total = $order->info['total'] - $order->info['shipping_cost'];
  if( DISPLAY_PRICE_WITH_TAX != 'true' ) $order_total -= $order->info['tax'];

  //check if there is free shipping
		if( MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True' ) {
			include( DIR_WS_LANGUAGES.$language.'/modules/shipping/freeamount.php' );
			//if free shipping is enabled, make sure the discount does not bring the order total below free shipping limit
			if( $order->info['shipping_cost'] == MODULE_SHIPPING_FREEAMOUNT_COST) { //if free shipping is the selected shipping method
				if( ( $order->info['total'] - $order->info['shipping_cost'] ) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT ) { //if the discount lowers the total below the free shipping limit
					return true;
				}
			}
		} else if( MODULE_SHIPPING_WFREEAMOUNT_STATUS == 'True' ) {
			include( DIR_WS_LANGUAGES.$language.'/modules/shipping/wfreeamount.php' );
			//if free shipping is enabled, make sure the discount does not bring the order total below free shipping limit
			if( $order->info['shipping_cost'] == MODULE_SHIPPING_WFREEAMOUNT_COST ) { //if free shipping is the selected shipping method
				if( ( $order->info['total'] - $order->info['shipping_cost'] ) < MODULE_SHIPPING_WFREEAMOUNT_AMOUNT ) { //if the discount lowers the total below the free shipping limit
					return true;
				}
			}
		} 

	//check if table rate shipping has changed			
	if( strtolower(MODULE_SHIPPING_TABLE_STATUS) == 'True' ) {
	include( DIR_WS_LANGUAGES.$language.'/modules/shipping/table.php' );
	if( substr($order->info['shipping_method'], 0, strlen(MODULE_SHIPPING_TABLE_TEXT_TITLE)) == MODULE_SHIPPING_TABLE_TEXT_TITLE && MODULE_SHIPPING_TABLE_MODE == 'price' ) {
	  $table_cost = split( "[:,]", MODULE_SHIPPING_TABLE_COST );
	  for( $i = 0; $i < count( $table_cost ); $i += 2 ) {
		if( $order_total <= $table_cost[$i] ) {
		  $shipping = $table_cost[$i+1];
		  break;
		}
	  }
	  if( $order->info['shipping_cost'] != $shipping ) { //if the discount lowers the total below the table rate
		return true;
	  } 
	}
  } else if( strtolower(MODULE_SHIPPING_WTABLE_STATUS) == 'True') {
	  include( DIR_WS_LANGUAGES.$language.'/modules/shipping/wtable.php' );
	if( substr($order->info['shipping_method'], 0, strlen(MODULE_SHIPPING_WTABLE_TEXT_TITLE)) == MODULE_SHIPPING_WTABLE_TEXT_TITLE && MODULE_SHIPPING_WTABLE_MODE == 'price' ) {
		$wtable_cost = split( "[:,]", MODULE_SHIPPING_WTABLE_COST );
		for( $i = 0; $i < count( $wtable_cost ); $i += 2 ) {
		  if( $order_total <= $wtable_cost[$i] ) {
			$wshipping = $wtable_cost[$i+1];
			break;
		  }
		 }
		 if( $order->info['shipping_cost'] != $wshipping ) { //if the discount lowers the total below the table rate
		   return true;
		 }
	  }
	}
  return false;
}

 

I then have this in my checkout_confirmation.php

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

 

I have found if I change from } else if { in between FREEAMOUNT and WFREEAMOUNT or TABLE and WTABLE statement sections rather than just ending them and starting a new "if" statement, it seems to work only if the customer is wholesale. If I change back to just starting a new "if" statement, it doesn't want to work at all and keeps redirecting the customer to the checkout_shipping.php page thinking that function is_recalc_shipping was true (even if it isn't).

 

The discount code does not hang out in the text box it gets entered in when you are redirected back to choose new shipping methods, and I think this is the bit of code that is also having some major issues. Every now and again I apparently hit on something when tweaking the classes/discount_coupons.php code as I can get the FREEAMOUNT or WFREEAMOUNT to function properly unless you then leave the discount coupon field empty (ie... you enter a coupon and it lowers you below the amount required for free shipping - so you are redirected back to choose shipping method. This time you do not enter a coupon during checkout_payment.php and it does not re-direct you back to choose shipping method - which it should do since without the coupon you do qualify for free shipping).

 

Anyway - if somebody knows if there is something that needs to be changed for this function to work with rc1 or rc2 - or if they have any ideas on how to better handle the different shipping options for customer groups it would be most appreciated as I feel like I'm just banging my head against a wall and getting nowhere :blush:

 

TIA


~Tracy
 

Share this post


Link to post
Share on other sites

Hi,

 

I have been happily using this fine contrib for a couple of months now, but have now spotted a problem.

 

Everything seems to work ok, all the admin options are there along with the reports section, and the coupons are working as advertised for customers.

 

However, it would appear that the use of a coupon is only being inserted into the database when a customer uses a vanilla payment option that came with osc, such as cash. When payments are made by any other option (I use paypal IPN, nochex and payofflinepro) no usage is being recorded in the database.

 

This is allowing customers to use the same coupon more than once. For example, we have a first order coupon set up with a 10% discount, with max use set to 1. I have picked up several instances of the same person using this discount twice.

 

In addition, lots of customers have used this discount, which has shown up properly during the checkout process, but there is no record of these uses in either the db tables or in the discount coupon report.

 

I am aware of, from this thread, there being issues with Paypal IPN and code to be inserted - is there a piece of stock code that needs to be placed into all these payment modules?

 

 

Great contrib.

 

 

Cheers,

 

Vimes.

Share this post


Link to post
Share on other sites

Tx to those are working on this project!!!

 

Have trouble with the script... In last march someone got the same trouble... It seem no one have respond to him!

 

When I made the checkout, the Sub-total is the double of what it should be!!!

 

Products (Edit)

1 x 'test' - product test(G608) $325.00

 

Payment Method (Edit)

Interact E-mail Money Tranfer

 

Sub-Total: $650.00

Per Item (Best Way): $40.00

Total: $690.00

 

Tx for your help!

 

Christian

Share this post


Link to post
Share on other sites
Tx to those are working on this project!!!

 

Have trouble with the script... In last march someone got the same trouble... It seem no one have respond to him!

 

When I made the checkout, the Sub-total is the double of what it should be!!!

 

Products (Edit)

1 x 'test' - product test(G608) $325.00

 

Payment Method (Edit)

Interact E-mail Money Tranfer

 

Sub-Total: $650.00

Per Item (Best Way): $40.00

Total: $690.00

 

Tx for your help!

 

Christian

 

Hi, Christian!

 

What discount are you trying to apply?

Share this post


Link to post
Share on other sites

all the discount are working fine! With or with out discount the store double the Sub-total! Who are calculate before any discount.

 

Tx

Share this post


Link to post
Share on other sites
the same thing happend to me.. i'm using RC2a with 3.31 version of DCC...

 

any help pls?

I am having the same problem. Coupon was working fine until we moved our site to new server 2 weeks ago and now the coupon discount is applied to all items - even the ones that are excluded.

 

please anyone? i have had to turn off coupon as a result but really do need it for a promotion we are doing.

 

thanks in advance!!

Share this post


Link to post
Share on other sites

Ok - I have upgraded to rc2a manually now and I still have this one issue. When a coupon is entered into the order, it doesn't want to properly re-calculate the shipping. If I manage to get it to recalculate when the coupon is first entered, it doesn't work right if they then remove the coupon from their order. Currently, if a coupon code is entered it does nothing but tell me to recalculate shipping and won't allow the order to process unless you go through twice with the coupon field blank. So I have the code commented out on the checkout_confirmation.php page until I can get it working properly.

 

Does anyone here possibly have any ideas?

 

Hoping somebody here has some ideas. I am trying to manually upgrade our store from 060817 to rc2 - at the moment I have done the steps for the manual upgrade to rc1 and I'm having a problem with the function is_recalc_shipping I am hoping to get this working before then doing the manual upgrading to rc2 (hopefully I won't need to re-do this function again for rc2 - LOL).

 

I have had to modify this function quite a bit as I have SPPC installed and our shipping files change based on which customer group a customer is logged in under. So - for example, a retail customer will have MODULE_SHIPPING_FREEAMOUNT_STATUS = 'True" whereas a wholesale customer will have MODULE_SHIPPING_WFREEAMOUNT_STATUS = 'True". The same goes for the TABLE and WTABLE (and I do have files for both freeamount.php and wfreeamount.php as well as table.php and wtable.php).

 

Therefore - I had to make some modifications to the includes/classes/discount_coupon.php file which now looks like this:

	function is_recalc_shipping() {
  global $order, $language;

  //calculate the order total:
  $order_total = $order->info['total'] - $order->info['shipping_cost'];
  if( DISPLAY_PRICE_WITH_TAX != 'true' ) $order_total -= $order->info['tax'];

  //check if there is free shipping
		if( MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True' ) {
			include( DIR_WS_LANGUAGES.$language.'/modules/shipping/freeamount.php' );
			//if free shipping is enabled, make sure the discount does not bring the order total below free shipping limit
			if( $order->info['shipping_cost'] == MODULE_SHIPPING_FREEAMOUNT_COST) { //if free shipping is the selected shipping method
				if( ( $order->info['total'] - $order->info['shipping_cost'] ) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT ) { //if the discount lowers the total below the free shipping limit
					return true;
				}
			}
		} else if( MODULE_SHIPPING_WFREEAMOUNT_STATUS == 'True' ) {
			include( DIR_WS_LANGUAGES.$language.'/modules/shipping/wfreeamount.php' );
			//if free shipping is enabled, make sure the discount does not bring the order total below free shipping limit
			if( $order->info['shipping_cost'] == MODULE_SHIPPING_WFREEAMOUNT_COST ) { //if free shipping is the selected shipping method
				if( ( $order->info['total'] - $order->info['shipping_cost'] ) < MODULE_SHIPPING_WFREEAMOUNT_AMOUNT ) { //if the discount lowers the total below the free shipping limit
					return true;
				}
			}
		} 

	//check if table rate shipping has changed			
	if( strtolower(MODULE_SHIPPING_TABLE_STATUS) == 'True' ) {
	include( DIR_WS_LANGUAGES.$language.'/modules/shipping/table.php' );
	if( substr($order->info['shipping_method'], 0, strlen(MODULE_SHIPPING_TABLE_TEXT_TITLE)) == MODULE_SHIPPING_TABLE_TEXT_TITLE && MODULE_SHIPPING_TABLE_MODE == 'price' ) {
	  $table_cost = split( "[:,]", MODULE_SHIPPING_TABLE_COST );
	  for( $i = 0; $i < count( $table_cost ); $i += 2 ) {
		if( $order_total <= $table_cost[$i] ) {
		  $shipping = $table_cost[$i+1];
		  break;
		}
	  }
	  if( $order->info['shipping_cost'] != $shipping ) { //if the discount lowers the total below the table rate
		return true;
	  } 
	}
  } else if( strtolower(MODULE_SHIPPING_WTABLE_STATUS) == 'True') {
	  include( DIR_WS_LANGUAGES.$language.'/modules/shipping/wtable.php' );
	if( substr($order->info['shipping_method'], 0, strlen(MODULE_SHIPPING_WTABLE_TEXT_TITLE)) == MODULE_SHIPPING_WTABLE_TEXT_TITLE && MODULE_SHIPPING_WTABLE_MODE == 'price' ) {
		$wtable_cost = split( "[:,]", MODULE_SHIPPING_WTABLE_COST );
		for( $i = 0; $i < count( $wtable_cost ); $i += 2 ) {
		  if( $order_total <= $wtable_cost[$i] ) {
			$wshipping = $wtable_cost[$i+1];
			break;
		  }
		 }
		 if( $order->info['shipping_cost'] != $wshipping ) { //if the discount lowers the total below the table rate
		   return true;
		 }
	  }
	}
  return false;
}

 

I then have this in my checkout_confirmation.php

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

 

I have found if I change from } else if { in between FREEAMOUNT and WFREEAMOUNT or TABLE and WTABLE statement sections rather than just ending them and starting a new "if" statement, it seems to work only if the customer is wholesale. If I change back to just starting a new "if" statement, it doesn't want to work at all and keeps redirecting the customer to the checkout_shipping.php page thinking that function is_recalc_shipping was true (even if it isn't).

 

The discount code does not hang out in the text box it gets entered in when you are redirected back to choose new shipping methods, and I think this is the bit of code that is also having some major issues. Every now and again I apparently hit on something when tweaking the classes/discount_coupons.php code as I can get the FREEAMOUNT or WFREEAMOUNT to function properly unless you then leave the discount coupon field empty (ie... you enter a coupon and it lowers you below the amount required for free shipping - so you are redirected back to choose shipping method. This time you do not enter a coupon during checkout_payment.php and it does not re-direct you back to choose shipping method - which it should do since without the coupon you do qualify for free shipping).

 

Anyway - if somebody knows if there is something that needs to be changed for this function to work with rc1 or rc2 - or if they have any ideas on how to better handle the different shipping options for customer groups it would be most appreciated as I feel like I'm just banging my head against a wall and getting nowhere :blush:

 

TIA


~Tracy
 

Share this post


Link to post
Share on other sites

I installed this and had an error I saw listed here,

 

Discount Coupons

1146 - Table 'store.discount_coupons' doesn't exist

 

select count(*) as total from discount_coupons cd

 

[TEP STOP]

 

(before "store" there was stuff related to my actual link)

 

and I saw the fix posted right below it, with some SQL stuff to run (I really don't know much about all this, but everything I did looked exactly like the directions said) and now I get a new error when I try to go to the catalog section of my admin site and click "BOX_CATALOG_DISCOUNT_COUPONS" in order to make a coupon. Now it's saying

 

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 '-20, 20' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -20, 20

 

[TEP STOP]

 

I'm also getting similar errors when I click on "Manufacturers," "Specials," "Tax Zones," "Tax Classes," "Tax Rates," "BOX_REPORTS_DISCOUNT_COUPONS," and "Newsletter Manager"

 

 

Does anyone have ANY idea what could be wrong to cause all of this stuff?! Every time in the past two weeks that I've been trying to get this working, I'll fix something and find a new problem. Thank you SO much to anyone who can get me all fixed up. :)

Share this post


Link to post
Share on other sites

I've honestly tried to read through the messages on here, I could have missed it - but don't think so.

 

I've got a WEIRD problem.

 

Everything is installed correctly.

 

When checking out, if I enter the the coupon code it correctly takes me to checkout_confirmation.php. If I enter the wrong code, it tells me that too.

 

BUT - If I don't enter a code at all... it pulls up the checkout_confirmation.php page as blank (an HTTP 500 error).

 

Has anyone encountered this or have any tips? I am completely stumped.

 

Thanks!

Share this post


Link to post
Share on other sites

Looking at the 1146 error below tells me that for some reason your database tables were not created. Being this happens in one of the files that you upload to your server from the contribution, my first guess would be that you didn't get all of the files uploaded - or that you uploaded them in Binary rather than ASCII mode and one or more of them were corrupted.

 

I would go back through the contribution and re-upload the "new" files (files that don't come with osC but are needed for Discount Coupon Codes to work) and make sure your FTP Program is uploading in ASCII mode when doing that.

 

Then go back through and see if you still have the 1146 error stating that a table doesn't exist. If so, we'll go to step two ;)

 

 

 

I installed this and had an error I saw listed here,

 

Discount Coupons

1146 - Table 'store.discount_coupons' doesn't exist

 

select count(*) as total from discount_coupons cd

 

[TEP STOP]

 

(before "store" there was stuff related to my actual link)

 

and I saw the fix posted right below it, with some SQL stuff to run (I really don't know much about all this, but everything I did looked exactly like the directions said) and now I get a new error when I try to go to the catalog section of my admin site and click "BOX_CATALOG_DISCOUNT_COUPONS" in order to make a coupon. Now it's saying

 

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 '-20, 20' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -20, 20

 

[TEP STOP]

 

I'm also getting similar errors when I click on "Manufacturers," "Specials," "Tax Zones," "Tax Classes," "Tax Rates," "BOX_REPORTS_DISCOUNT_COUPONS," and "Newsletter Manager"

 

 

Does anyone have ANY idea what could be wrong to cause all of this stuff?! Every time in the past two weeks that I've been trying to get this working, I'll fix something and find a new problem. Thank you SO much to anyone who can get me all fixed up. :)


~Tracy
 

Share this post


Link to post
Share on other sites

I would try using a file comparison tool, such as WinMerge, to compare your checkout_payment.php and checkout_confirmation.php files with those in the contribution. I would also double check that you are uploading in ASCII and not in Binary (the weirdest issues quite frequently are caused by uploading php files in Binary).

 

 

I've honestly tried to read through the messages on here, I could have missed it - but don't think so.

 

I've got a WEIRD problem.

 

Everything is installed correctly.

 

When checking out, if I enter the the coupon code it correctly takes me to checkout_confirmation.php. If I enter the wrong code, it tells me that too.

 

BUT - If I don't enter a code at all... it pulls up the checkout_confirmation.php page as blank (an HTTP 500 error).

 

Has anyone encountered this or have any tips? I am completely stumped.

 

Thanks!


~Tracy
 

Share this post


Link to post
Share on other sites
Looking at the 1146 error below tells me that for some reason your database tables were not created. Being this happens in one of the files that you upload to your server from the contribution, my first guess would be that you didn't get all of the files uploaded - or that you uploaded them in Binary rather than ASCII mode and one or more of them were corrupted.

 

I would go back through the contribution and re-upload the "new" files (files that don't come with osC but are needed for Discount Coupon Codes to work) and make sure your FTP Program is uploading in ASCII mode when doing that.

 

Then go back through and see if you still have the 1146 error stating that a table doesn't exist. If so, we'll go to step two ;)

 

Thank you so much, this did appear to solve that issue. Of course, now I've got a new one (that's how it's been going...haha). I had been uploading in binary apparently, which I didn't realize was bad. Actually I think I had "auto" selected, but regardless, that error has gone away. All the links I mentioned are now working great...except one. The Catalog>Discount Coupons link (it's showing up correctly now instead of the weird "BOX_CATALOG_DISCOUNT_COUPONS") is giving me an error I saw earlier in the thread, and the person says they fixed it, but I don't quite know what they did. I'm now getting the message

 

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, 20

 

[TEP STOP]

 

Their reply to this problem said "Fixed ! I found that when creating the tables in the database, the prefix "coupons_" was left off of a few columns" but I don't completely understand what I should be doing to solve this. I've sent this person a private message, but I figured I would reply here as well to let you know that the first problem was fixed, and just in case someone else can help me with the new problem as well. Thanks again for all your help!!!

Share this post


Link to post
Share on other sites

I thought for SURE the link for "Admin Login Issue with OsC RC2" would be exactly what was going wrong for me, but still no luck getting in to be able to create coupons. Someone must understand what would be causing my issue, and how the other person was able to solve it. You people are all smarter than me...have at it. haha

Share this post


Link to post
Share on other sites

First question - do you have phpMyAdmin access to your MySQL database? If so, you can change it directly in your database. You will want to click on the "discount_coupons" table on the left side of your screen, and then you can select (via a checkbox) each section in that table that does not have coupons_ in front of it. Click the little pencil (edit) symbol at the bottom, and then you can type coupons_ in front of each section in the "Field" box. Click save and it should be all fixed.

 

If not - we will need to re-write the SQL to drop the table if it exists and then create the table again, this time with the coupons_ bit in front of the various table row names. I just don't know how to run the SQL query without the phpMyAdmin access. I am hoping that it could just be corrected in the php file that has this in it already - run Discount Coupons one time to get it to perform the task on the database, and then remove the "drop table if exists" bit so that it doesn't constantly want to re-create that table and dump all of the info in it.

 

 

Thank you so much, this did appear to solve that issue. Of course, now I've got a new one (that's how it's been going...haha). I had been uploading in binary apparently, which I didn't realize was bad. Actually I think I had "auto" selected, but regardless, that error has gone away. All the links I mentioned are now working great...except one. The Catalog>Discount Coupons link (it's showing up correctly now instead of the weird "BOX_CATALOG_DISCOUNT_COUPONS") is giving me an error I saw earlier in the thread, and the person says they fixed it, but I don't quite know what they did. I'm now getting the message

 

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, 20

 

[TEP STOP]

 

Their reply to this problem said "Fixed ! I found that when creating the tables in the database, the prefix "coupons_" was left off of a few columns" but I don't completely understand what I should be doing to solve this. I've sent this person a private message, but I figured I would reply here as well to let you know that the first problem was fixed, and just in case someone else can help me with the new problem as well. Thanks again for all your help!!!


~Tracy
 

Share this post


Link to post
Share on other sites
First question - do you have phpMyAdmin access to your MySQL database? If so, you can change it directly in your database. You will want to click on the "discount_coupons" table on the left side of your screen, and then you can select (via a checkbox) each section in that table that does not have coupons_ in front of it. Click the little pencil (edit) symbol at the bottom, and then you can type coupons_ in front of each section in the "Field" box. Click save and it should be all fixed.

 

If not - we will need to re-write the SQL to drop the table if it exists and then create the table again, this time with the coupons_ bit in front of the various table row names. I just don't know how to run the SQL query without the phpMyAdmin access. I am hoping that it could just be corrected in the php file that has this in it already - run Discount Coupons one time to get it to perform the task on the database, and then remove the "drop table if exists" bit so that it doesn't constantly want to re-create that table and dump all of the info in it.

 

ShaBAM!! This worked! date_start and date_end did not have "coupons_" in front of them, so I added them. There's also max_use and min_order that don't have coupons_ in front. I noticed these didn't show up in the errors, so I tried it without altering these, and it seems to work ok. But do you know if I should be adding the "coupons_" prefix in front of max_use and min_order as well?

Thank you SO much for the help. I figured it was going to be some simple little 30-second fix, but it would have taken me forever to figure out I'm sure.

Share this post


Link to post
Share on other sites

Glad you were able to get it working. In my store I have the coupons_ prefix in front of max_use and min_order. I would assume you will need it as well. These database fields help to determine, when creating a coupon, if there is a minimum order amount or a maximum number of times the coupon code can be used - so if you try creating a coupon and entering something into those fields, I would think it would generate an error if you need the coupons_ prefix and don't have it (or vice versa) :blush:

 

 

ShaBAM!! This worked! date_start and date_end did not have "coupons_" in front of them, so I added them. There's also max_use and min_order that don't have coupons_ in front. I noticed these didn't show up in the errors, so I tried it without altering these, and it seems to work ok. But do you know if I should be adding the "coupons_" prefix in front of max_use and min_order as well?

Thank you SO much for the help. I figured it was going to be some simple little 30-second fix, but it would have taken me forever to figure out I'm sure.


~Tracy
 

Share this post


Link to post
Share on other sites
Glad you were able to get it working. In my store I have the coupons_ prefix in front of max_use and min_order. I would assume you will need it as well. These database fields help to determine, when creating a coupon, if there is a minimum order amount or a maximum number of times the coupon code can be used - so if you try creating a coupon and entering something into those fields, I would think it would generate an error if you need the coupons_ prefix and don't have it (or vice versa) :blush:

Ok great, I'll trust that since you have it working and don't seem to have any problems, that I should go ahead and put them on. And that should pretty much fix everything, after two weeks of countless different issues. Muchas gracias! Time to try and promote some more now.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×