Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Hi There,

 

I seem to have a problem that i can not fix myself.

 

I read en search the topic for my problem but i did not find the solution.

 

I get this error page between page Checkout Payment and Checkout Confirmation.

 

Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/dwcarstyling.nl/httpdocs/includes/classes/discount_coupon.php) is not within the allowed path(s): (/home/httpd/vhosts/dwcarstyling.nl/httpsdocs:/tmp) in /home/httpd/vhosts/dwcarstyling.nl/httpsdocs/includes/modules/order_total/ot_discount_coupon.php on line 14

 

Warning: main(/home/httpd/vhosts/dwcarstyling.nl/httpdocs/includes/classes/discount_coupon.php): failed to open stream: Operation not permitted in /home/httpd/vhosts/dwcarstyling.nl/httpsdocs/includes/modules/order_total/ot_discount_coupon.php on line 14

 

Fatal error: main(): Failed opening required '/home/httpd/vhosts/dwcarstyling.nl/httpdocs/includes/classes/discount_coupon.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/dwcarstyling.nl/httpsdocs/includes/modules/order_total/ot_discount_coupon.php on line 14

 

I have done everythink in my power off but i do not now what to do now.

 

I hope some body can help my whit this error.

 

Beste Regard Dennis

 

I have the solution already found

 

Thanks.

Share this post


Link to post
Share on other sites

I just installed this on a test site, but during checkout payment when I add a valid code that is set for no minimum amount, no start or expiry date, etc...I keep getting the error that it is not valid--any ideas why?

 

I can checkout fine without the code entered, so seems there may be some code missing possibly from somewhere, I went back thru and all was done properly so far as I can see, and I have installed hundreds of contributions so I know what I am doing in that respect---I appreciate any ideas!!

 

Thanks for the help!


"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Share this post


Link to post
Share on other sites
I just installed this on a test site, but during checkout payment when I add a valid code that is set for no minimum amount, no start or expiry date, etc...I keep getting the error that it is not valid--any ideas why?

 

I can checkout fine without the code entered, so seems there may be some code missing possibly from somewhere, I went back thru and all was done properly so far as I can see, and I have installed hundreds of contributions so I know what I am doing in that respect---I appreciate any ideas!!

 

Thanks for the help!

 

The first thing I would do is double check that you are entering the coupon exactly as you have it in Admin (including case)

 

The second thing I would check is your includes/classes/discount_coupon.php file - make sure that it didn't get corrupted on FTP (I've had that happen before and it's caused me great stress only to find that re-uploading in ASCII fixed it - LOL) I'm pretty sure this is the file that handles checking to see if you are using a valid coupon code.


~Tracy
 

Share this post


Link to post
Share on other sites
Ok I commented it out and now when there are three items (one for $99, one for $49 and one for $0) it shows a $10 off coupon as $6.66 (roughly 2/3 of $10). Is there a way to tell it to not calculate products if their cost is less than or equal to 0? Also I keep getting a "can't divide by zero" error so I wrapped lines 113 and 114 in the following if statment and it no longer displays this error:

if($product['final_price'] != 0) {
		$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'];
	}

 

It's better then what it was but still it's only 2/3 of the discount not the total amount. Your help is appreciated.

 

 

Since you have a product with a price of zero, you'll need to add to that function to set the price to 1 for the sake of the calculation.

 

if($product['final_price'] != 0) {
					if( $product['final_price'] == 0 ) $product['final_price'] = 1;
		$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'];
	}

 

This should fix the divide by zero message as well as add in that last 1/3 of the discount (discounts are applied to each item in the cart).


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
It's the either/or scenario. They still have the ability to enter their own coupon code, but if they leave the coupon field blank and their order quantity is >= 2 then a hidden coupon gets applied.

 

I just realized that I can add min and max values to the hidden coupons to keep people from using them when they aren't supposed to, but I would rather they just didn't ever seen the coupon code.

 

 

The true problem you're experiencing is that you cannot use more than one coupon.

 

To allow for more than one coupon to be applied to an order, you need to edit includes/classes/order.php. You should then be able to hide the automatic discount fairly easily.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
THANK YOU!!

 

CASE#1

9 x zCover TypeOn APKDA fits Apple Desktop & Wireless Keyboard , Sony Vegas $449.55

1 x zCover care removable lanyard $4.99

 

Discount Coupon $2.14 Discount applied: -$2.15

Sub-Total: $452.39

Shipping Rate: $7.50

Total: $459.89

 

CASE #2

10 x zCover TypeOn APKDA fits Apple Desktop & Wireless Keyboard , Sony Vegas $499.50

1 x zCover care removable lanyard $4.99

Discount Coupon $2.14 Discount applied: -$2.17

Sub-Total: $502.32

Shipping Rate: $7.50

Total: $509.82

 

CASE#3 (no problem one)

1 x zCover TypeOn APKDA fits Apple Desktop & Wireless Keyboard , Sony Vegas $49.95

1 x zCover care removable lanyard $4.99

Discount Coupon $2.14 Discount applied: -$2.14

Sub-Total: $52.80

Shipping Rate: $7.50

 

this Coupon has setup with following setting

Description: $2.14 Discount

Percent Discount:1.00 OR Desired Fixed Discount:2.14

Start Date:

End Date:

Max Use:

Min Order: 2.14

Max Order: 2.14

Number Available:

Thank you very much for your help :)

 

The problem you're having is because the discount is applied evenly to each item. The carts that give incorrect discount amounts do so because the price difference between the items is high. This will be fixed in the next version of DCC that is released.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

We are having an issue with the confirmation email showing the correct price for items. Right now it just shows $0.00. I noticed that others have had this issue as well but I see no resolution.

 

In addition we have reviewed everything that we did and cannot locate the issue.

 

Any help would be appreciated!


Need Hosting? Just ask!

Share this post


Link to post
Share on other sites
We are having an issue with the confirmation email showing the correct price for items. Right now it just shows $0.00. I noticed that others have had this issue as well but I see no resolution.

 

In addition we have reviewed everything that we did and cannot locate the issue.

 

Any help would be appreciated!

 

 

This contribution reads the product prices, but does not alter them. I do not recall anyone else having problems with zero prices in the confirmation email.

 

I would say the issue is likely due to a conflict between DCC and another contribution. Identifying what else you have installed would be a good first step.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

What we can tell is that the pricing gets to the email but the product line is 0.00, see below.

We do have totalb2b installed. But that code doesn't appear to interact with your code.

note that the price of the item is 5.10

 

Products

------------------------------------------------------

1 x Afghan Blk/wh (DB24SDA) = $0.00

------------------------------------------------------

Sub-Total: $5.10

Handling Fee (On Re-orders under $100.00): $5.00

Total: $10.10

 

Why would that product item be zero, it was working before we installed the contribution.


Need Hosting? Just ask!

Share this post


Link to post
Share on other sites
What we can tell is that the pricing gets to the email but the product line is 0.00, see below.

We do have totalb2b installed. But that code doesn't appear to interact with your code.

note that the price of the item is 5.10

 

Products

------------------------------------------------------

1 x Afghan Blk/wh (DB24SDA) = $0.00

------------------------------------------------------

Sub-Total: $5.10

Handling Fee (On Re-orders under $100.00): $5.00

Total: $10.10

 

Why would that product item be zero, it was working before we installed the contribution.

 

 

This contribution does not alter the product price. I cannot tell you why you're getting the results you are. You're the only one I know who has had this problem. The b2b contribution you use changes the way the product prices are displayed in the email. I'd start by checking with that contribution.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

What's the purpose of max order??

 

The calculations doesn't appear correct.

 

I enter 300 as min order, 3000 as max order and percentage as .05 (5 percent)

 

I place an order for $600. and the discount is $150. ( equals 5 percent times my max order - which is 3000)

I really want 5 percent times my order ($600) which should be $30.

is this correct?

 

I just want a 5% discount on any order over $300. with no max, how would I set this up?

thanks,

steve

Share this post


Link to post
Share on other sites
What's the purpose of max order??

 

The calculations doesn't appear correct.

 

I enter 300 as min order, 3000 as max order and percentage as .05 (5 percent)

 

I place an order for $600. and the discount is $150. ( equals 5 percent times my max order - which is 3000)

I really want 5 percent times my order ($600) which should be $30.

is this correct?

 

I just want a 5% discount on any order over $300. with no max, how would I set this up?

thanks,

steve

 

 

If you enter a max order, the discount will always be applied to that amount.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I just want a 5% discount on any order over $300. with no max, how would I set this up?

thanks,

steve

 

You would create a coupon for 5% with a MIN amount of $300 - no max amount :thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites
Since you have a product with a price of zero, you'll need to add to that function to set the price to 1 for the sake of the calculation.

 

if($product['final_price'] != 0) {
					if( $product['final_price'] == 0 ) $product['final_price'] = 1;
		$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'];
	}

 

This should fix the divide by zero message as well as add in that last 1/3 of the discount (discounts are applied to each item in the cart).

 

 

Just as an FYI the above code did not work since if the price was = 0 then it would never run this code since it only looked to see if the price does not equal zero. The following code works however. Thank you for pointing me in the right direction.

 

if($product['final_price'] != 0) {
		$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'];
	} else {
		$product['final_price'] = 1;
		$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'];
	}

Share this post


Link to post
Share on other sites
If you enter a max order, the discount will always be applied to that amount.

 

Why would the coupon apply the discount to the Max Order value and not the actual Order Total? What is the logic behind that? Isn't the field max order to specify the maximum order total that can be used with a coupon? Or does this field have different meanings depending on the coupon type? Can someone please explain this mysterious field?

Edited by cYon

Share this post


Link to post
Share on other sites
Why would the coupon apply the discount to the Max Order value and not the actual Order Total? What is the logic behind that? Isn't the field max order to specify the maximum order total that can be used with a coupon? Or does this field have different meanings depending on the coupon type? Can someone please explain this mysterious field?

 

 

Fixed discounts are actually percentage discounts applied to a fixed amount (the max order). This gives a fixed discount. The discussion of this & why can be found earlier in this thread. If you're using a percentage discount, leave the max order field blank.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

I searched the first couple of pages, but could not find this referenced.

 

I installed all of the files were put in their proper folders (or so I think), however, I'm getting the following error in checkout...

 

 

 

Warning: main(/mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalogincludes/classes/discount_coupon.php): failed to open stream: No such file or directory in /mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalog/includes/modules/order_total/ot_discount_coupon.php on line 14

 

Fatal error: main(): Failed opening required '/mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalogincludes/classes/discount_coupon.php' (include_path='.:/usr/local/nf/lib/php') in /mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalog/includes/modules/order_total/ot_discount_coupon.php on line 14

 

 

Obviously, something is wrong where it says catalogincludes as it should be catalog/includes I assume. I noticed in the readme document it said the following.

 

Problem:

Warning: include(***file1***) [function.include]: failed to open stream: No

such file or directory in ***file2*** on line ***line#***

 

Solution:

Ensure that you have uploaded ***file1*** to the correct directory.

 

 

But that is not the problem it seems.

 

Instead, I did notice that it asked me to put files in locations such as...

 

**************** STEP 1 ****************

Upload files

 

The following files need to be uploaded to your site. If you have made any

changes to code or installed any other contributions, you should manually

edit the existing files. If you need to manually edit these files, go to

Step 1A at the end of this file.

 

New files:

 

catalog/includes/classes/discount_coupon.php

catalog/includes/modules/order_total/ot_discount_coupon.php

catalog/includes/languages/english/modules/order_total/ot_discount_coupon.php

admin/coupons.php

admin/includes/languages/english/coupons.php

admin/includes/languages/english/coupons_manual.html

admin/includes/languages/english/images/buttons/button_new_coupon.gif

 

 

 

 

 

I don't have a root admin folder. I have catalog/admin and that is where i put all the admin files, as they corresponded with the correct files it asked me to replace.

 

I am on Netfirms which uses osCommerce.

 

Please help

Share this post


Link to post
Share on other sites
I searched the first couple of pages, but could not find this referenced.

 

I installed all of the files were put in their proper folders (or so I think), however, I'm getting the following error in checkout...

Warning: main(/mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalogincludes/classes/discount_coupon.php): failed to open stream: No such file or directory in /mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalog/includes/modules/order_total/ot_discount_coupon.php on line 14

 

Fatal error: main(): Failed opening required '/mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalogincludes/classes/discount_coupon.php' (include_path='.:/usr/local/nf/lib/php') in /mnt/w0707/d39/s15/b0259e3b/www/checkout/nfoscomm/catalog/includes/modules/order_total/ot_discount_coupon.php on line 14

 

 

The solution lies in going to the ot_discount_coupon.php file in \catalog\includes\classes and making the top look like this...

 

<?php

/*

* ot_discount_coupons.php

* August 4, 2006

* author: Kristen G. Thorson

*

* ot_discount_coupon_codes version 2.0

*

* Released under the GNU General Public License

*

*/

 

//try removing this line if you're getting an error like Fatal error: Cannot redeclare class discount_coupon in ***path to shop***/includes/classes/discount_coupon.php on line 14

//require_once( DIR_FS_CATALOG.DIR_WS_CLASSES.'discount_coupon.php' );

 

This will "remove" the last line and corrected the problem for me.

Share this post


Link to post
Share on other sites

Hi

 

Just installed this but it doesn't work.

 

I have "Paypal IPN v1.4" http://www.oscommerce.com/community/contributions,2679 installed and looked at the latest update added, but the Paypal IPN file has changed quite a lot since it was done.

 

Anyone got an update for this mod as i would really like to use it.

 

Also i have "Paypal Express Checkout IPN" http://www.oscommerce.com/community/contributions,4791 installed, so i guess i will need an update for that as well.

 

 

Any help?

 

Cheers Richard

Share this post


Link to post
Share on other sites

can anyone post or send me some screen shots of this mod?

i've been researching easy discount, ccgv, and the contribution of this thread. so far this one seems to be a solid choice with good support. TIA

 

richie

Share this post


Link to post
Share on other sites

Can someone please post a screen shot of what it sopposed to look like in the Admin, I can't find anything in my admin besides the module area that lets me create coupons after I installed this.

Share this post


Link to post
Share on other sites
Can someone please post a screen shot of what it sopposed to look like in the Admin, I can't find anything in my admin besides the module area that lets me create coupons after I installed this.

 

The support has not ended - sometimes the people who can support get swamped with other tasks and it might take a couple days to get here and post :blush:

 

I have many other contrib's installed at the moment as well as having Discount Coupon Codes v3 installed for testing, so I don't want my screenshots to confuse others - so I'll let someone else post the screen shots - but:

 

If you go to your Admin/Modules/Order Total You will find the controls for Discount Coupon Codes that let you turn it on or off, decide what order you want the discount to show in during checkout - etc...

 

Then - Admin/Catalog/Discount Coupons is where you create your coupons.

 

Hopefully Kristen will be able to get back to the forum this week - I know she was swamped last week with work. I can help with some of the easier questions but I don't use it with PayPal so I am not able to help there :blush:


~Tracy
 

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

×