Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

This looks like a great contribution..I was just wondering, what does the "Number Available" field refer to? I guess it doesnt mean the number of times it can be used? because that is probably Max used? Or does Max used mean maximum use per customer?

 

Any clarification would really help.

 

Ash

 

 

You should find a link in the upper right corner of that very page that explains what each field is for.

 

Max Use is a limit for each customer. 2 would mean a customer with that coupon code can use it 2 times, and no more.

 

Number Available limits the number of times the coupon can be used for all customers. "The first 200 customers get 10% off" type of thing. The 201st customer that tries to use the code will not be able to receive a discount.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I was also wondering, does the contribution actually allow you to see, how many times a coupon has been used?

 

Indeed it does, In admin>Reports>Discount Coupons

Share this post


Link to post
Share on other sites

I am kinda on the fence with regards to the free shipping,

 

I can understand y people wud do it, however Osc can be set to give free shipping with a certain value.

 

I would like to see maybe a discounted shipping.

 

I am looking for a contrib that will give free\reduced shipping if certain products are added to the cart.

 

I know of some sites that offer this but I dont think they are using Osc.

Share this post


Link to post
Share on other sites

I have installed the "Discount Coupon Codes" contribution.

I am doing a marketing campaign with a 25% discount using a coupon to the first 100 customers. I do not want this coupon to work on products currently discounted on the site in the "Specials" section.

 

Is it possible to make this contribution not apply it's discount to the "Specials" currently offered on the page, and how?

If No: Is there another discount module that will accomplish this?

 

Thank you in advance!

Share this post


Link to post
Share on other sites

Hey,

 

I just recently installed this contrib (version 2.1) and I rather like it, but I'm running into some issues. Everything works fine until I get to the checkout confirmation page (catalog/checkout_confirmation.php). The page shows up completely blank unless I go into Modules > Order Total and set the sort order for Discount Coupons equal to another module (i.e. the Shipping module's sort order is 3, so if I set Discount Coupon's to 3 the page loads). However, even when I do this the coupon is not displayed, the page simply loads, but the sub-total displays the correct, discounted amount. So it appears that the module does its job, but the information is not displayed correctly. Any help with this would be greatly appreciated, and sorry for being so long winded >__> I tend to ramble <__<

 

As I said, I have version 2.1 installed. If you require any code, I will be happy to post whatever you need. Thanks again.


Ian Osos

Web Developer

Share this post


Link to post
Share on other sites
I have installed the "Discount Coupon Codes" contribution.

I am doing a marketing campaign with a 25% discount using a coupon to the first 100 customers. I do not want this coupon to work on products currently discounted on the site in the "Specials" section.

 

Is it possible to make this contribution not apply it's discount to the "Specials" currently offered on the page, and how?

If No: Is there another discount module that will accomplish this?

 

Thank you in advance!

 

Try changing the function calculate_discount() in includes/classes/discount_coupon.php to the following:

 

	function calculate_discount( $product, $product_count ) {
		$applied_discount = 0;
		if (DISPLAY_PRICE_WITH_TAX == 'true') {
			//if there's a maximum order amount to apply the discount to, determine the percentage of this product's final price we should apply the discount to
			$max_applied_percentage = ( $this->coupon['coupons_max_order'] == 0 ? '1.00' : $this->coupon['coupons_max_order'] / ( tep_add_tax( $product['final_price'] * $product['qty'], $product['tax'] ) * $product_count ) );
		  $applied_discount = tep_add_tax( $product['final_price'] * $max_applied_percentage * $this->coupon['coupons_discount_percent'], $product['tax'] ) * $product['qty'];
		  //don't allow the discount amount to be more than the product price
		  if( $applied_discount > ( tep_add_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) ) $applied_discount = tep_add_tax( $product['final_price'], $product['tax'] ) * $product['qty'];
		} else if( !( $special_price = tep_get_products_special_price( $product['products_id'] ) ) ) {
	//if there's a maximum order amount to apply the discount to, determine the percentage of this product's final price we should apply the discount to
			$max_applied_percentage = ( $this->coupon['coupons_max_order'] == 0 ? '1.00' : $this->coupon['coupons_max_order'] / ( $product['final_price'] * $product['qty'] * $product_count ) );
		  $applied_discount = $product['final_price'] * $max_applied_percentage * $this->coupon['coupons_discount_percent'] * $product['qty'];
		  //don't allow the discount amount to be more than the product price
		  if( $applied_discount > ( $product['final_price'] * $product['qty'] ) ) $applied_discount = $product['final_price'] * $product['qty'];
		}
		return $applied_discount;
	}


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I just recently installed this contrib (version 2.1) and I rather like it, but I'm running into some issues. Everything works fine until I get to the checkout confirmation page (catalog/checkout_confirmation.php). The page shows up completely blank unless I go into Modules > Order Total and set the sort order for Discount Coupons equal to another module (i.e. the Shipping module's sort order is 3, so if I set Discount Coupon's to 3 the page loads). However, even when I do this the coupon is not displayed, the page simply loads, but the sub-total displays the correct, discounted amount. So it appears that the module does its job, but the information is not displayed correctly.

 

Usually when you get completely blank pages, it's because your host has display_errors turned off. Add the following two lines to the top of includes/application_top.php:

 

ini_set( 'error_reporting', E_ALL & ~E_NOTICE );

ini_set( 'display_errors', 1 );

 

See if you get an error displayed when you set the sort order to a unique value.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Thanks for such a speedy reply, kgt. I added those lines of code and changed the sort order to a unique value; however, I still get a blank page.


Ian Osos

Web Developer

Share this post


Link to post
Share on other sites
Thanks for such a speedy reply, kgt. I added those lines of code and changed the sort order to a unique value; however, I still get a blank page.

 

 

You will need to determine what the error is. Look in your webroot or just above for a php_error file. If that doesn't exist, try your host's control panel.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hello, having a problem with this contribution...

 

Installed it as instructed, everything seems ok but when I go to Catalog / Discount Coupons I get this:

 

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

 

I don't know much SQL, so trying to solve this is a struggle... can anyone help?

Share this post


Link to post
Share on other sites
Hello, having a problem with this contribution...

 

Installed it as instructed, everything seems ok but when I go to Catalog / Discount Coupons I get this:

 

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

 

I don't know much SQL, so trying to solve this is a struggle... can anyone help?

 

http://forums.oscommerce.com/index.php?sho...;hl=1064+syntax


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hi,

 

I just installed the Contribution.

 

And i have the following problem.

 

I set the options and created a coupon. When I try to buy something, I get to the checkout_payment.php screen,.... and enter the coupon code.

 

If I enter invalid coupon code and click the \\\'continue\\\' button or if it has to redirect me back to shipping page because my new total now is under my free shipping amount , it kicks me out to the login screen, and goes into an endless loop there..

 

 

 

 

Can anyone help?????

 

Thanks

 

Mike

Share this post


Link to post
Share on other sites

Turns out it was that "fatal error blah blah blah" thing... just commented out that line of code and now it works. Thank you very much for the help, and nice work with this contrib.


Ian Osos

Web Developer

Share this post


Link to post
Share on other sites
Hi,

 

I just installed the Contribution.

 

And i have the following problem.

 

I set the options and created a coupon. When I try to buy something, I get to the checkout_payment.php screen,.... and enter the coupon code.

 

If I enter invalid coupon code and click the \\\\\\\'continue\\\\\\\' button or if it has to redirect me back to shipping page because my new total now is under my free shipping amount , it kicks me out to the login screen, and goes into an endless loop there..

Can anyone help?????

 

Thanks

 

Mike

 

The problem was when you use this cntribution with ultimate SEO you need to patch seo.class.php to correctly redirect.

 

Thank you

 

Mike

Share this post


Link to post
Share on other sites
You've probably already made the changes. If you have successfully changed the column date_start to coupons_date_start and you try to run those statements, you would get exactly that error.

 

Thank you for your help - I think I have made some progress because I went back and re added the entire contribution from 2.0 - the most recent, but now I get the following error message when I attempt to add a coupon:

 

1054 - Unknown column 'coupons_number_available' in 'field list'

 

insert into discount_coupons ( coupons_id, coupons_description, coupons_discount_percent, coupons_date_start, coupons_date_end, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available) values ('0AB2KVPV', '', '', null, null, 0, 0, 0, 0)

 

 

Do you have any ideas on how to correct this error?

 

James

Share this post


Link to post
Share on other sites
Thank you for your help - I think I have made some progress because I went back and re added the entire contribution from 2.0 - the most recent, but now I get the following error message when I attempt to add a coupon:

 

1054 - Unknown column 'coupons_number_available' in 'field list'

 

insert into discount_coupons ( coupons_id, coupons_description, coupons_discount_percent, coupons_date_start, coupons_date_end, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available) values ('0AB2KVPV', '', '', null, null, 0, 0, 0, 0)

Do you have any ideas on how to correct this error?

 

You probably need to run the alter table statements for 2.1. Just not more than once.

 

I can't tell you what's wrong without knowing the layout of your database and the tables. Look in your database, in the discount_coupons table.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

First off, thanks for a great contrib. My only issue right now is "coupons.php" does not show up in my admin page. I can manually goto the page, but it does not show up in the menubox.

 

The other thing I have: a suggestion, how would (or could it be done) one impliment a "Free S/H" coupon. So say, orders over 50$ get free s/h with code.

 

Thanks.

Share this post


Link to post
Share on other sites
You probably need to run the alter table statements for 2.1. Just not more than once.

 

I can't tell you what's wrong without knowing the layout of your database and the tables. Look in your database, in the discount_coupons table.

 

Thanks

 

That could be the [a] problem. I have run the "alter" table statements a few times. Each time I went back and changed the code I would re-run the statements. Is there anyway to backup and start completely over?

 

My biggest problem is that I worked backwards on this contribution. I installed the most recent 1st and then went back followed the instructions from 2.0 forward.

 

James

Edited by JamesS

Share this post


Link to post
Share on other sites
Thanks

 

That could be the [a] problem. I have run the "alter" table statements a few times. Each time I went back and changed the code I would re-run the statements. Is there anyway to backup and start completely over?

 

My biggest problem is that I worked backwards on this contribution. I installed the most recent 1st and then went back followed the instructions from 2.0 forward.

 

James

 

 

You should be making manual backups whenever you make changes to the database. MySQL will not automatically make a backup for you when you alter the database structure.

 

Just provide the state of your table as it is now. And tell me which version of this contribution you're trying to use. If you don't know how to get the table structure, just enter this into the SQL tab:

 

SHOW CREATE TABLE discount_coupons


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

This comntribution is fantatic, however I have one small problem.

 

On the checkout_confirmation.php page the following error occurs:

 

 

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

 

SELECT coupons_discount_percent, coupons_description, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available FROM TABLE_DISCOUNT_COUPONS WHERE coupons_id = 'testcoupon' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

[TEP STOP]

 

 

However, the table IS in the DB.

 

I have also checked that everything is declared in both /includes/filenames.php and admin/includes/filenames.php

 

I have also resubmitted the SQL statements and rechecked all the files, but still no ideas.... anyone have any idea what might be causing this?

 

TIA! :rolleyes:

Share this post


Link to post
Share on other sites

getting the following

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /catalog/admin/includes/functions/database.php:13) in /catalog/admin/includes/functions/database.php on line 13

 

Everything else seems to work fine just can't get the report to work.

 

 

Any ideas?

 

It shows up directky after clicking on the Discount Coupon Link in the report section.

I've checked all files involved yet I can't find the problem.

Share this post


Link to post
Share on other sites

I'm having a problem with sortof a combination of mods here. I use paypal direct payment pro on my website. This mod works perfectly if the customer selects to pay via direct payment visa, mastercard, etc. However, if they choose paypal express pay, it skips checkout_payment.php entirely... So they never have a place to enter the code.

 

Would it be at all possible to set it up so they can enter the coupon code at the bottom of the shipping page, rather then the payment page? I have been fiddling with this a bit but not been able to get it to work- I can make it display the box and stuff ~ correctly but you enter a code, go through the process and it doesn't show up on the order confirmation page.

 

The store is live- you can fiddle around with it a bit and see what I am talking about if you like: www.20squared.com

 

 

 

TIA

 

Pete

Edited by peter.blais

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

×