Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Evening all, a few problems on this one.

 

I've just installed the latest version, a few problems but the subtotal fix + actually reading the instructions sorted them out :)

 

2 main problems left, one is that on checkout_payment.php and checkout_confirmation.php my tables are broken, it ends up looking like;

helprg0.jpg

 

Any ideas what's causing this?

 

And more importantly, it seems i've got a problem with Paypal that no one else does :)

 

I'm using "Paypal website payments standard", and it carries over the data fine (it carried it over when the subtotal didn't work), but now for some reason whenever I put a coupon code in (works fine when no code is put in), it takes me to the paypal site with this message;

paypalhelpxs1.jpg

 

The table problem, while annoying, I can live with for now. But the Paypal problem is a fairly large one :D

 

Anyone have any ideas as to why this is happening?

Link to comment
Share on other sites

My server has recently been upgraded to php5 and discount coupons are now not showing on checkout_confirmation page unless I refresh my page. Is the above fix for this problem and if so where is the relevant code found? (I searched and could not find it anywhere in my site )

 

Probably.

 

includes/classes/discount_coupon.php

Link to comment
Share on other sites

Ok guys, a little update on my problems.

 

It seems everything works fine, i'm just a little limited to what I can do with the coupons.

I was trying to use a coupon to get the final price down to 0.02p, mainly so I could test it worked without risking any of my money.

After a little working on it, it seems the vouchers work fine as long as the final price is above £1.50 :)

 

Slightly awkward, but then again when am I going to need to give such a discount that people can get products for under £1.50 any way :D

 

So my last problem then;

 

on checkout_payment.php and checkout_confirmation.php my tables are broken, it ends up looking like;

helprg0.jpg

 

I've gone through the code on both pages and can't see anything wrong, any ideas?

 

And Inveritas - did you mean that as an answer to one of my questions?

Link to comment
Share on other sites

Download this fix and apply per instructions. It worked for me.

 

Bug Fix for subtotals problem

 

-=Charles

Hi,

 

I'm a french user of your DCC contribution and, as agrafuese, I'm trying to fix the issue when we choose "false" for not displaying discount in the subtotal.

The code offers by agrafuese works half cause it don't apply tax both in subtotal and total (amounts are out of tax) :

	  if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
	//we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax
	$actual_shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	$applied_discount = 0;
//agrafuese - subtotal fix	
	$shown_price = $product['final_price'] * $product['qty'];
	} else {
		$applied_discount = 0;
		$shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	}
/**********		
  }
  $shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
**********/
// END agrafuese - subtotal fix

When I tried to let appear tax in subtotal, total is wrong :

	  if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
	//we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax
	$actual_shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	$applied_discount = 0;
//agrafuese - subtotal fix	
	$shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] );
	} else {
		$applied_discount = 0;
		$shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	}
/**********		
  }
  $shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
**********/
// END agrafuese - subtotal fix

It is a little pity to leave things as well, don't you think ?

 

Do you have as me the same issue when the discount is not applied to sub-total ?

Do you know a way to solve this problem ?

 

Thank you for your attention.

 

milerwan

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

Anybody know why admin/coupons.php on line 14 requires includes/functions/coupons.php when includes/functions/coupons.php does not exist in the contribution? This is killing me. Everything seems to work OK except that this missing file prevents me from being able to add any coupons in admin.

 

Can someone send me the file that should be placed in includes/functions ?

Link to comment
Share on other sites

I am wondering if there is any way to apply the coupon and reflect the discounted subtotal in the shopping cart, or wherever, before you put your credit card info. Some people might not like to add their credit card info to know the actual discounted subtotal.

 

Thanks!!

Ed

:blink:

Link to comment
Share on other sites

I am wondering if there is any way to apply the coupon and reflect the discounted subtotal in the shopping cart, or wherever, before you put your credit card info. Some people might not like to add their credit card info to know the actual discounted subtotal.

 

Thanks!!

Ed

:blink:

Many people wait for this bug fix but nobody seems to work on... :(

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

With the latest version of osCommerce, the credit card info is entered on the order confirmation page - so you do see your subtotal before you enter the info. Have you made the suggested updates if you aren't running the latest version?

 

 

Many people wait for this bug fix but nobody seems to work on... :(

~Tracy
 

Link to comment
Share on other sites

I've uploaded all the files and checked over twice to make sure they are all uploaded, but whenever I click on Discount Coupons in my Admin section it comes up with this error.

I've even tried uploading most of the files again.

I've had this problem on previous site, but have no idea how I fixed it.

I've run all the SQL statements given but they've had no affect.

 

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

 

select count(*) as total from discount_coupons cd

 

[TEP STOP]

 

 

Any ideas?

 

Thanks

Link to comment
Share on other sites

I've seen this error in this forum before. You can do a google search for:

 

site:www.oscommerce.com/forums "Discount Coupons" +table +discount_coupons +"doesn't exist"

 

I believe you should be able to go into your phpMyAdmin and simply edit or add the table(s) you are missing.

 

 

I've uploaded all the files and checked over twice to make sure they are all uploaded, but whenever I click on Discount Coupons in my Admin section it comes up with this error.

I've even tried uploading most of the files again.

I've had this problem on previous site, but have no idea how I fixed it.

I've run all the SQL statements given but they've had no affect.

 

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

 

select count(*) as total from discount_coupons cd

 

[TEP STOP]

 

 

Any ideas?

 

Thanks

~Tracy
 

Link to comment
Share on other sites

With the latest version of osCommerce, the credit card info is entered on the order confirmation page - so you do see your subtotal before you enter the info. Have you made the suggested updates if you aren't running the latest version?

Sorry this is a misunderstanding, I mentioned the fact that you can not have the real subtotal products without the rebate amount applied.

That's the problem I mentioned when MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' .

 

We arrive at a good subtotal by changing this :

//agrafuese - subtotal fix	
	$shown_price = $product['final_price'] * $product['qty'];
	} else {
		$applied_discount = 0;
		$shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	}

By this :

		$shown_price = $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'];
	} else {
		$applied_discount = 0;
		$shown_price = ( $this->apply_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) - ( $discount['applied_discount'] + $discount['discount_tax'] );
	}

But total is wrong.

 

So it is necessary to change the caculate of the total in this line (around 413) :

MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //subtract the discount from the order total if it's not displayed in the subtotal
	  foreach( $this->applied_discount as $discount ) {
		$info['total'] -= $discount;

I have tried somethings like that :

MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //subtract the discount from the order total if it's not displayed in the subtotal
	  $final_discount = $discount['applied_discount'] + $discount['discount_tax'];
	  foreach( $this->final_discount as $discount ) {
		$info['total'] -= $discount;

But the object $this->final_discount is invalid and the caculating isn't made.

 

Do you have any idea how could we do this calculating ?

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

With the latest version of osCommerce, the credit card info is entered on the order confirmation page - so you do see your subtotal before you enter the info. Have you made the suggested updates if you aren't running the latest version?

 

Hello...

What I meant was that it would be great if one could add a coupon in your Shopping Cart instead of doing it on the Payment Confirmation page. Kind of like adding a new product, but instead adding a coupon and then see the new discounted price reflected.

 

Ed.

Link to comment
Share on other sites

  • 2 weeks later...
Did you download the latest? There was a bugfix for that problem.

 

Hi KGT,

 

Could you tell me in which file(s) your bug fix is in as I don't want to do the full install again since I have to add each file manually because of other mods I made in files.

 

If you just tell me which files to change I can look through for the changes.

 

Thanks,

Kemi

Link to comment
Share on other sites

Ignore my last post as it makes no sense here.

 

 

I just installed the Discount Coupon Codes and it's working well except it won't discontinue the coupon that I had made for one use. You are able to reuse this coupon again without it saying it's been used already.

 

The table for stats in the reports section doesn't show that it was used although it shows used on the invoice. I also noted that it didn't print the coupon or the order total on the email notification.

 

Any help here would be appreciated. I should say that I didn't just upload the files to overwrite my old files as I had made some modifications to files like english.php and filename.php so I went through and copied and pasted what I found to be new code for the discount coupons. Did I perhaps miss something?

 

thanks

Kemi

Link to comment
Share on other sites

Ed. This is certainly do-able as that is exactly how I have it on my own shop.

 

However, I do not use this particular contribution, I use a different one.

 

Hello!

Yes, I did some research and I think I know which one you are taking about. Thanks.

Link to comment
Share on other sites

Ignore my last post as it makes no sense here.

 

 

I just installed the Discount Coupon Codes and it's working well except it won't discontinue the coupon that I had made for one use. You are able to reuse this coupon again without it saying it's been used already.

 

The table for stats in the reports section doesn't show that it was used although it shows used on the invoice. I also noted that it didn't print the coupon or the order total on the email notification.

 

Any help here would be appreciated. I should say that I didn't just upload the files to overwrite my old files as I had made some modifications to files like english.php and filename.php so I went through and copied and pasted what I found to be new code for the discount coupons. Did I perhaps miss something?

 

thanks

Kemi

 

Okay, so I fixed the above problem. I made an error in uploading files.

 

But now I have double checked everything and the problem I have is that when I make a coupon for multiple uses by the same person for example one coupon with two uses, after the first use the users name shows up in the reports and after they try to use it again they are told that the coupon is not valid and their name is removed from the coupons report and left blank but still showing one use still available.

 

Anyone?

Link to comment
Share on other sites

Ed. This is certainly do-able as that is exactly how I have it on my own shop.

 

However, I do not use this particular contribution, I use a different one.

 

 

I had the Coupon Code working fine. I have added additional contributions since, but I have gone back to check the code of all the modified files, and everything is still in tact. The error the customer is receiving is "The minimum order total for this coupon is $X.XX. Some or all of the products in your cart are excluded." The discount does not apply to any items. Everything in the Admin panel appears to be in order.

 

Your assistance would greatly be appreciated.

Link to comment
Share on other sites

Hi,

I get the following error on the confirmation page if I try to enter the correct code:

1054 - Unknown column 'geo_zone_id' in 'from clause'

SELECT dc2z.geo_zone_id FROM discount_coupons_to_zones dc2z LEFT JOIN zones_to_geo_zones z2g USING( geo_zone_id ) WHERE ( z2g.zone_id=88 or z2g.zone_id = 0 or z2g.zone_id IS NULL ) AND ( z2g.zone_country_id=81 or z2g.zone_country_id = 0 ) AND dc2z.coupons_id="XXX"

[TEP STOP]

What does it mean?

Thank you!

Link to comment
Share on other sites

Hi, I just installed this contribution and had to manually edit each file as I have a modified template. Everything except my admin area works. I can login to the admin area, but once I am there, all I see is the links under configuration. I see the original oscommerce header, then the list of links under configuration and a blank white page where everything should be. Any idea what the cause of this could be?

 

Thanks!

Link to comment
Share on other sites

Hi, I just installed this contribution and had to manually edit each file as I have a modified template. Everything except my admin area works. I can login to the admin area, but once I am there, all I see is the links under configuration. I see the original oscommerce header, then the list of links under configuration and a blank white page where everything should be. Any idea what the cause of this could be?

 

Thanks!

 

Just a guess but did you maybe overwrite one of your admin files? I'm new to this too but that's my guess.

Link to comment
Share on other sites

Please Please PLEASE can someone post instructions on how to incorporate FEC and Discount Coupon Codes. A few people have said they have successfully installed both together, but cannot seem to achieve this myself.

 

Have looked for some instructions, but can't find anything.

 

I have FEC 3.2 and Discount Coupon Code 3.2.

 

I would really appreciate some help.

 

 

Thanks

My latest osCommerce work in progress

 

no outside links in signatures allowed, see PM

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