Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Hi Kristen,

 

Great to see you still working on this fantastic contribution.

 

I have installed your latest version installed, All I changed was the link to the manual in admin panel so that it would open in a new page.

 

However I see that I cant really edit the coupons IE if I wanted to change it name or its value I cant. Only way this can be done is to delete the coupon and the re-create one.

 

Is this possible to change easily?

 

reason I ask is I have created a coupe of coupon and maybe got a field wrong, like putting the percentsge discount in as a percentage like 10 instead of a decimal amount of 0.10

 

as you will know this will result in a discount of 1000% :huh: To change this I then to delete the coupon and re-create it with a decimal amount instead.

 

Best Regards

Shaun

Share this post


Link to post
Share on other sites

Ok I cant figure out whats up with this problem. When I go to the admin menu and go to catalog and hit the Discount Coupons link it gives me:

 

Not Found

 

The requested URL /admin/FILENAME_DISCOUNT_COUPONS was not found on this server.

 

Am I missing a file or something? Im sure I placed all the files in the right places. As a matter of fact there isnt even a file that is named "FILENAME_DISCOUNT_COUPONS" in the download. Do I need to manually create this page? Any help in this matter would greatly be appreciated. Thanks for your time.

Share this post


Link to post
Share on other sites
Ok I cant figure out whats up with this problem. When I go to the admin menu and go to catalog and hit the Discount Coupons link it gives me:

 

Not Found

 

The requested URL /admin/FILENAME_DISCOUNT_COUPONS was not found on this server.

admin/includes/filenames.php --------------------------------------------------

 

add

 

//kgt - discount coupons

define('FILENAME_DISCOUNT_COUPONS','coupons.php');

define('FILENAME_DISCOUNT_COUPONS_MANUAL', 'coupons_manual.php');

//end kgt - discount coupons


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Actually I solved the problem on my own. In admin/includes/filename.php I had to add a simple <space> to a line of code. I think your reply to me was wrong as well. In the line:

 

define('FILENAME_DISCOUNT_COUPONS','coupons.php');

 

there is supposed to be a space after the , so it is supposed to look like this:

 

define('FILENAME_DISCOUNT_COUPONS', 'coupons.php');

 

 

I cut and pasted this code straight from the install.txt file I downloaded so that is actually wrong as well.

 

Thanks for your help and thank you for the great Contribution.

Share this post


Link to post
Share on other sites

Hello,

 

I have installed the coupon discount and it works well.... but, some time now, the VAT is added twice, even when the customer doesn't use a discount coupon. And it is not paypal or CB payment related.

 

my site www.e-modelisme.com

 

 

real example :

 

1 x H?licopt?re t?l?command? DF4_DEB 19.6% 141.30EUR 169.00EUR 141.30EUR 169.00EUR

Sub-total: 196,70 EUR [should be only 169.00 EUR as the 141.30 + VAT = 169 !!!]

Shipping (2.2 kg): 7.55EUR

VAT: 27,70 EUR

Total: 204,25 EUR

 

It should be only 169 + 7.55 = 176,55 EUR

 

Any idea ?

 

Thank you in advance for your support,

 

best regars

Edited by bienenf

Share this post


Link to post
Share on other sites
This is the support thread for the Order Total contribution Discount Coupon Codes found here:

 

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

 

 

Hi,

 

Great Job, It saved my times. I installed your contribution, i got the error message-1054 - Unknown column 'coupons_date_start' in 'order clause'

 

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

 

on my admin coupons page.

 

Why.

 

Help me please. Thank you very much.

Share this post


Link to post
Share on other sites
Hi nice contrib, but i have a small problem.

 

The instal has been sucessfull, apart from at checkout_confrimation.php has not updated the the total price and not on any page after.

 

How can i fix this problem???

 

However the file, includes/boxes/shopping_cart.php has and works fine and the admin side is working well too.

Many thanks

 

I have also run into this problem and I have read through EVERYTHING in this post. I've deleted and recreated the tables in PHPMyAdmin, I've removed and reinstalled the discount coupon module in admin/modules.php, I've edited the sort order (from 1 to 6), I've added various lines of code that have been posted here (of course, some code wont be relevant) and still the discount is not applied.

 

I have no idea how to fix whatever I've messed up. I'm not so hot with PHP and OSC, but I can follow any instructions you can give me to sort this out.

 

Thanks.

Edited by deji01

Share this post


Link to post
Share on other sites
Great Job, It saved my times. I installed your contribution, i got the error message-1054 - Unknown column 'coupons_date_start' in 'order clause'

 

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

 

on my admin coupons page

 

It's one of either two things. First, you may have mysql 5 on strict mode, which could throw an error (but I don't think it would be this error). Changing line 275 in admin/coupons.php from

$coupons_query_raw = "select * from " . TABLE_DISCOUNT_COUPONS . " cd order by cd.coupons_date_end, coupons_date_start";

to

$coupons_query_raw = "select * from " . TABLE_DISCOUNT_COUPONS . " cd order by cd.coupons_date_end, cd.coupons_date_start";

MIGHT fix this error.

 

Otherwise, there's something wrong with your table structure. I'd need to have you enter the following into your SQL tab in phpMyAdmin:

 

SHOW CREATE TABLE discount_coupons

 

And post the result.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I have also run into this problem and I have read through EVERYTHING in this post. I've deleted and recreated the tables in PHPMyAdmin, I've removed and reinstalled the discount coupon module in admin/modules.php, I've edited the sort order (from 1 to 6), I've added various lines of code that have been posted here (of course, some code wont be relevant) and still the discount is not applied.

 

I have no idea how to fix whatever I've messed up. I'm not so hot with PHP and OSC, but I can follow any instructions you can give me to sort this out.

 

See my response below:

 

http://forums.oscommerce.com/index.php?sho...id=953550


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hello,

 

I have installed the coupon discount and it works well.... but, some time now, the VAT is added twice, even when the customer doesn't use a discount coupon. And it is not paypal or CB payment related.

 

my site www.e-modelisme.com

real example :

 

1 x H?licopt?re t?l?command? DF4_DEB 19.6% 141.30EUR 169.00EUR 141.30EUR 169.00EUR

Sub-total: 196,70 EUR [should be only 169.00 EUR as the 141.30 + VAT = 169 !!!]

Shipping (2.2 kg): 7.55EUR

VAT: 27,70 EUR

Total: 204,25 EUR

 

It should be only 169 + 7.55 = 176,55 EUR

 

 

Can you give me some more information about your install? Do you have "Display prices with tax?" set to true? What other contributions do you have installed (particularly ones that affect the order class such as paypal IPN, etc)?

 

In includes/modules/order_total/ot_discount_coupon.php, uncomment the following two lines around line 33:

//print_r( $order ); //kgt - use this to debug order object contents
	  //print_r( $this->coupon ); //kgt - use this to debug coupon object contents

Go through the checkout procedure and on the confirmation page you will see some debug information. Please copy and paste that information to me in an email and I will take a look at it.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi Kristen,

 

Great to see you still working on this fantastic contribution.

 

I have installed your latest version installed, All I changed was the link to the manual in admin panel so that it would open in a new page.

 

However I see that I cant really edit the coupons IE if I wanted to change it name or its value I cant. Only way this can be done is to delete the coupon and the re-create one.

 

Is this possible to change easily?

 

reason I ask is I have created a coupe of coupon and maybe got a field wrong, like putting the percentsge discount in as a percentage like 10 instead of a decimal amount of 0.10

 

as you will know this will result in a discount of 1000% :huh: To change this I then to delete the coupon and re-create it with a decimal amount instead.

 

Best Regards

Shaun

 

 

Hi Shaun!

 

The link is a good idea. I will add that change as well.

 

I don't think the code field was ever editable when editing an existing coupon. I made the other fields uneditable because of the calculation that needs to happen when you're doing the "fixed" discount thing. I didn't want to deal with people changing one field and forgetting to change another for fixed discounts and asking why it got all wonky.

 

It's no big deal to disable the non-editable status. Just search for " disabled" (without the quotes but including the leading space) in admin/coupons.php and replace with "" (that's nothing, not two quotes). Don't try changing the coupon code though. You'll either get an error or a whole new coupon.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I think I may have found a way to get a reliable fixed amount discount:

 

function calculate_discount( $product, $product_count ) {
	   if ( $this->coupon['coupons_type'] == 'fixed') {

	   $applied_discount = $this->coupon['coupons_discount_percent'] * $this->coupon['coupons_max_order'] / $product_count;

  } else {

		$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'];

		if( $applied_discount > ( $product['final_price'] * $product['qty'] ) ) $applied_discount = $product['final_price'] * $product['qty'];

		}
		return $applied_discount;
	}

 

I added one field to the 'discount_coupons' table, "coupons_type". If it's set as 'fixed' then it calculates a set amount, otherwise it calculates a percentage. It seems to be working ok.

 

I think this will work fine. I have already changed that function to do the tep_add_tax() only if DISPLAY_PRICES_WITH_TAX is true. I'll add this too. Good work!


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Thanks Kristen it worked like a charm :D

 

Also is it worth adding djmonkey1's change for the fixed amounts?

Share this post


Link to post
Share on other sites

Thanks Kristen it worked like a charm :D

 

Also is it worth adding djmonkey1's change for the fixed amounts?

Share this post


Link to post
Share on other sites
I think this will work fine. I have already changed that function to do the tep_add_tax() only if DISPLAY_PRICES_WITH_TAX is true. I'll add this too. Good work!

 

Excellent... it's a great mod, thanks for all the hard work!


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Hi-

I have been trying for days to install a coupon code to my site and really need help. At this point I am not even sure that the files are uploading correctly. Can anybody help out a newbie?

Share this post


Link to post
Share on other sites
Hi-

I have been trying for days to install a coupon code to my site and really need help. At this point I am not even sure that the files are uploading correctly. Can anybody help out a newbie?

 

What method are you using to upload your files?

 

What are you using to edit your files with?

 

Is your store a stock osC base or have your made other mods to it?

 

If you are using a stock osC store with no mods just upload the files contained within the download.

Share this post


Link to post
Share on other sites

Is it at all possible to make the coupon code on the checkout_confirmation page to be in bold and or a different colour? just to make it stand out a little more like the actual total amount is?

 

Regards

Shaun

Share this post


Link to post
Share on other sites
Is it at all possible to make the coupon code on the checkout_confirmation page to be in bold and or a different colour? just to make it stand out a little more like the actual total amount is?

 

Regards

Shaun

 

 

You have the ability to edit the way the line displays in the configuration for the module. Add HTML <b> tags around the

.

Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
You have the ability to edit the way the line displays in the configuration for the module. Add HTML <b> tags around the
.

 

Thanks Kristen, I had actually done this in the php file without success never thought to try in the actual module :D

 

 

Yes, unless you're displaying prices with tax.

 

My prices are displyed with Tax so I wont make that change.

 

Thanks :D

Shaun

Share this post


Link to post
Share on other sites

I just installed this contribution tonight. So far, it worked without a hitch. Thank you for a clean install. My store has about 24 contribs installed already.

 

I did a test purchase via check/money order, but have not been able to do one via PayPal because I do not have an extra account to access and Sandbox never works for me. So, until I find someone to do a simple purchase for (and quickly refund), I'm gonna have to take it on blind faith that the information transfers to PayPal smoothly.

 

One small idea. You may want to add into the install instructions that one can find where to create a discount coupon under Catalog, which is also the place one can find the link to the manual. I did not know this, so I had to go within my directory to my english file to view the manual in order to find out where to create a coupon. Unless I am one of the few people having a brain fart about where to find it LOL.


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites
I did a test purchase via check/money order, but have not been able to do one via PayPal because I do not have an extra account to access and Sandbox never works for me. So, until I find someone to do a simple purchase for (and quickly refund), I'm gonna have to take it on blind faith that the information transfers to PayPal smoothly.

 

If you're using a recent version of Brian Burton's WPP module, don't count on it- read the recent posts in the WPP thread starting here:

http://forums.oscommerce.com/index.php?sho...981&st=1480


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
I just installed this contribution tonight. So far, it worked without a hitch. Thank you for a clean install. My store has about 24 contribs installed already.

 

I did a test purchase via check/money order, but have not been able to do one via PayPal because I do not have an extra account to access and Sandbox never works for me. So, until I find someone to do a simple purchase for (and quickly refund), I'm gonna have to take it on blind faith that the information transfers to PayPal smoothly.

 

You will need to make sure you have your paypal set to aggregate cart items/total (whatever the language is exactly). If you have it set on itemized, paypal will recalculate the total and the discount will be lost.

 

One small idea. You may want to add into the install instructions that one can find where to create a discount coupon under Catalog, which is also the place one can find the link to the manual. I did not know this, so I had to go within my directory to my english file to view the manual in order to find out where to create a coupon. Unless I am one of the few people having a brain fart about where to find it LOL.

 

The manual used to be a text file saved with the install instructions. I change it to HTML to make it more accessible when you're creating coupons and moved to the language directory but forgot to add a note on where to find it! I will add in the next release. Thanks for the feedback!


Contributions

 

Discount Coupon Codes

Donations

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

×