Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Thanks KGT, I appreciate the help. I fixed that file, but now getting this error:

Warning: main(/home/httpd/vhosts/pathtodomain/httpdocs/productsincludes/classes/discount_coupon.php): failed to open stream: No such file or directory in /home/httpd/vhosts/pathtodomain/httpdocs/products/includes/modules/order_total/ot_discount_coupon.php on line 14

 

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

 

I checked it out, and all the files are uploaded though.

 

Line 14 is:

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

 

But that file is there too.

 

Is there supposed to be no / (slash) between the "products" and "includes" dir in those errors above?

 

The line *should* not be necessary, so you shouldn't run into any problems by commenting it out. The other way to get rid of the error is to ensure that DIR_FS_CATALOG in admin/includes/configure.php has a trailing slash at the end of the path.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

I just downloaded Admin Coupon Usage Report for 2.*

When I go to my admin panel and click on Discount Coupons under the Reports tab, I get this error message:

 

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

 

select count(*) as total from discount_coupons AS dc left join discount_coupons_to_orders AS dcto ON dc.coupons_id = dcto.coupons_id

 

[TEP STOP]

 

I'm reading a lot of threads about running a SQL Query, but that wasn't in the intructions in the install.txt file and I followed it to the letter.

 

Any ideas?

 

Thanks. Lisa

Share this post


Link to post
Share on other sites
I just downloaded Admin Coupon Usage Report for 2.*

When I go to my admin panel and click on Discount Coupons under the Reports tab, I get this error message:

 

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

 

select count(*) as total from discount_coupons AS dc left join discount_coupons_to_orders AS dcto ON dc.coupons_id = dcto.coupons_id

 

[TEP STOP]

 

I'm reading a lot of threads about running a SQL Query, but that wasn't in the intructions in the install.txt file and I followed it to the letter.

 

Any ideas?

 

Thanks. Lisa

 

Is the name of your database really 'mysql5238bfdb72313c74d20ea958753'? That's an impressively obscure name.

 

Did you install Discount Coupon Codes first?


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Guest

One more variant...

 

Is it possible for this mod to only apply the discount to specific MANUFACTURER ?

 

Is it possible for this mod to only apply the discount to specific categories?

 

:'(

Share this post


Link to post
Share on other sites
One more variant...

 

Is it possible for this mod to only apply the discount to specific MANUFACTURER ?

:'(

 

I'm afraid it's not currently possible to do either. It's a feature I plan to include in the future, but I can't even give an estimated date. I'm just swamped with other work at the moment and can't justify the time to get it working right now.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm afraid it's not currently possible to do either. It's a feature I plan to include in the future, but I can't even give an estimated date. I'm just swamped with other work at the moment and can't justify the time to get it working right now.

 

I'd be happy to pay if that would push it up your priorities?

Share this post


Link to post
Share on other sites

I'm having this trouble : (and yes, I did install the newest upgrade version 2.1 today)

 

When I use Paypal as my payment method, the paypal url's parameter 'amount' ends up being 0 in the link!!

 

Basiclaly once i click "Confirm Order" and it switches from my site to the paypal site the amount shows 0.

 

The only time this worked is when I set the currency of paypal orders to "Only CAD" - that time it worked, BUT if I use "Only USD" or "Selected Currency" it does not work, it shows a 0 instead.

 

 

http://www.jageng.com/garage9/

 

Test it out for yourself.

 

My currency structure- there is no Canadian Currency under the currency section under "localization" it's just plain simple USD, 1.00000000 converstion ratio. All prices are totally fine up until the point where it confirms the order, but at the paypal transfer stage, it turns 0.

 

 

I failed to search any other cases of this elsewhere, so i figured it's probably this mod.. altho i did write a post on the general support section as well.

Share this post


Link to post
Share on other sites

I found a very minor bug today in this contribution. The link in the admin page (catalog>discount coupons) to the online manual links to custom_manual.php, but the file is named .html. I have changed the file extension on the page to .php so the link is no longer broken, and uploaded the full install again, including the recent reporting functionality.

 

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

 

Appears to be a great contribution. My customer will be very happy, I think. :)

Share this post


Link to post
Share on other sites

Great contrib kgt,

 

one question : in the order confirmation email, discount amount appear in the same line that shipping costs amount like this :

 

Bon de r?duction xxxxxxxxxx utilis?: -4.60EUR Frais de port (Colissimo Suivi): 10.10EUR

 

How can i put a line return after discount amount ?

 

Thanks

 

:thumbsup:

 

is there a 1.4 to 2.1 upgrade file somewhere ?

Edited by zoulxp

Share this post


Link to post
Share on other sites

Though the manual points out this contributions primary fault, I feel it should be re-stated here for those looking for support. I do so in the first item below, and add some commentary.

 

1) The discount created by this module may be a few cents off due to the method used to calculate. This is explained further in the documentation. READ THE DOCUMENTATION! You'll be glad that you did.

 

2) If you and your customers are sticklers for exactness, don't use this Discount Coupon Code contribution. I'd really like to be able to recommend another, but I am unable to do so at this time.

 

3) When creating a fixed amount coupon, the Discount column in Admin>Catalog>Discount Coupon Codes is displayed as a percentage of the specified minimum order. So if you create a coupon for $3.99, and set the minimum order to $1, then the Discount Column displays 399%. VERY DISCONCERTING for new store admins, and tough to explain to them. A specified discount should be just that, not a percentage. So be aware of this problem.

 

4) Sending orders to PayPal as Itemized has always been a problem, it seems. This is true using this contribution too, according to the manual. I don't know how much of a problem this is just yet, but if it becomes a problem for my client, I will post here the extent of the problem. The solution, of course, is to send as an aggregate to PayPal. For my client, this is not an ideal solution. He prefers the itemized method.

 

5) This is a very good start for a very useful contribution. I don't understand the intricacies of the coding and why a fixed amount discount couldn't work better ($5 is $5, after all, not $5.02 or $4.97), and 10% is 10%, not 10.25% or 11%.

Share this post


Link to post
Share on other sites

Hi, this looks to be a very nice contribution :thumbsup:

 

I'm about to go ahead an install, however... I already have the Quantity Price Breaks Contribution installed on the site I'm working on, and was just wondering if getting this contribution on there would cause any conflict with the price break code?

 

I've backed everything up, so I may just try a manual install and see how things go, but any advice/ suggestions would be appreciated :rolleyes:

Share this post


Link to post
Share on other sites

I'm reciving this SQL-error when I'm trying to reach admin/coupons.php:

 

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

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

[TEP STOP]

 

And this SQL-error when I'm trying to reach admin/stats_discount_coupons.php:

 

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

select dc.coupons_id, dc.coupons_discount_percent, dc.coupons_number_available, COUNT(dcto.discount_coupons_to_orders_id) AS coupons_use_count from discount_coupons AS dc left join discount_coupons_to_orders AS dcto ON dc.coupons_id = dcto.coupons_id group by dc.coupons_id order by coupons_use_count desc, dc.coupons_id asc limit -50, 50

[TEP STOP]

 

Any suggestions? <_<

Edited by petsk

Share this post


Link to post
Share on other sites
Though the manual points out this contributions primary fault, I feel it should be re-stated here for those looking for support. I do so in the first item below, and add some commentary.

 

1) The discount created by this module may be a few cents off due to the method used to calculate. This is explained further in the documentation. READ THE DOCUMENTATION! You'll be glad that you did.

 

2) If you and your customers are sticklers for exactness, don't use this Discount Coupon Code contribution. I'd really like to be able to recommend another, but I am unable to do so at this time.

 

3) When creating a fixed amount coupon, the Discount column in Admin>Catalog>Discount Coupon Codes is displayed as a percentage of the specified minimum order. So if you create a coupon for $3.99, and set the minimum order to $1, then the Discount Column displays 399%. VERY DISCONCERTING for new store admins, and tough to explain to them. A specified discount should be just that, not a percentage. So be aware of this problem.

 

4) Sending orders to PayPal as Itemized has always been a problem, it seems. This is true using this contribution too, according to the manual. I don't know how much of a problem this is just yet, but if it becomes a problem for my client, I will post here the extent of the problem. The solution, of course, is to send as an aggregate to PayPal. For my client, this is not an ideal solution. He prefers the itemized method.

 

5) This is a very good start for a very useful contribution. I don't understand the intricacies of the coding and why a fixed amount discount couldn't work better ($5 is $5, after all, not $5.02 or $4.97), and 10% is 10%, not 10.25% or 11%.

 

 

Since you're looking into #4, I can tell you the only way I know of to resolve the problem is to send the product prices with the discount applied. Paypal (at least since I last looked) has no way to add additional order total lines, and I don't think negative amounts in the order total line work either.

 

#5 happens because of rounding. CCGV handles this by recalculating order totals, but I'm not convinced this is a good method as it really changes the way OSC works and so can cause problems with other modules. I'm looking for a solution that will be accurate but is unlikely to interfere with other contributions. Any suggestions are welcome.

 

Thanks for the comments! I agree the fixed discount is the biggest problem, and that's what I will be spending the most time on in the next releases.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm reciving this SQL-error when I'm trying to reach admin/coupons.php:

 

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

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

[TEP STOP]

 

And this SQL-error when I'm trying to reach admin/stats_discount_coupons.php:

 

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

select dc.coupons_id, dc.coupons_discount_percent, dc.coupons_number_available, COUNT(dcto.discount_coupons_to_orders_id) AS coupons_use_count from discount_coupons AS dc left join discount_coupons_to_orders AS dcto ON dc.coupons_id = dcto.coupons_id group by dc.coupons_id order by coupons_use_count desc, dc.coupons_id asc limit -50, 50

[TEP STOP]

 

Any suggestions? <_<

 

See

 

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

http://www.oscommerce.com/ext/update-20060817.txt


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi, this looks to be a very nice contribution :thumbsup:

 

I'm about to go ahead an install, however... I already have the Quantity Price Breaks Contribution installed on the site I'm working on, and was just wondering if getting this contribution on there would cause any conflict with the price break code?

 

I've backed everything up, so I may just try a manual install and see how things go, but any advice/ suggestions would be appreciated :rolleyes:

 

I don't think you'll run into any problems. The coupon code affects mainly how OSC handles order totals, so it should be happening "after" the quantity price breaks. Of course, I'd recommend setting up a test site to test it out first.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Great contrib kgt,

 

one question : in the order confirmation email, discount amount appear in the same line that shipping costs amount like this :

 

Bon de r?duction xxxxxxxxxx utilis?: -4.60EUR Frais de port (Colissimo Suivi): 10.10EUR

 

How can i put a line return after discount amount ?

 

Thanks

 

:thumbsup:

 

is there a 1.4 to 2.1 upgrade file somewhere ?

 

I'm not sure why you're not getting a separate line. This is handled in checkout_process.php by printing each order total line with a line break after it, so it's not something that should be affected by the addtion of another order total module. Can you email or PM me the code you have for checkout_process.php?

 

There are upgrade files from 1.4->2.0->2.1. If you want to do 1.4->2.1, then just do the database changes in the 1.4->2.0 upgrade, then do the database changes in the 2.0->2.1 upgrade. Then follow the install instructions for 2.1. Of course, I didn't write the install or upgrade instructions with 1.4->2.1 in mind so it might not be as easy as 1.4->2.0->2.1.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm having this trouble : (and yes, I did install the newest upgrade version 2.1 today)

 

When I use Paypal as my payment method, the paypal url's parameter 'amount' ends up being 0 in the link!!

 

Basiclaly once i click "Confirm Order" and it switches from my site to the paypal site the amount shows 0.

 

The only time this worked is when I set the currency of paypal orders to "Only CAD" - that time it worked, BUT if I use "Only USD" or "Selected Currency" it does not work, it shows a 0 instead.

http://www.jageng.com/garage9/

 

Test it out for yourself.

 

My currency structure- there is no Canadian Currency under the currency section under "localization" it's just plain simple USD, 1.00000000 converstion ratio. All prices are totally fine up until the point where it confirms the order, but at the paypal transfer stage, it turns 0.

I failed to search any other cases of this elsewhere, so i figured it's probably this mod.. altho i did write a post on the general support section as well.

 

 

Is this a problem you can limit to occuring only with this contribution installed? It sounds like it's not something that could be caused by this contribution.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hi,

 

I have downloaded and installed this contribution. It works fine.

 

Problem is that any orders I have received (not using the discount codes or using the discount codes) is not showing up in the admin section. I am receiving payment details from PayPal but there is no order in the admin section.

 

This has only happened since installing this contribution.

 

Please help.

 

David

Share this post


Link to post
Share on other sites
Hi,

 

I have downloaded and installed this contribution. It works fine.

 

Problem is that any orders I have received (not using the discount codes or using the discount codes) is not showing up in the admin section. I am receiving payment details from PayPal but there is no order in the admin section.

 

This has only happened since installing this contribution.

 

Please help.

 

David

 

 

Please read through this:

 

http://forums.oscommerce.com/index.php?sho...184766&st=0


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm not sure why you're not getting a separate line. This is handled in checkout_process.php by printing each order total line with a line break after it, so it's not something that should be affected by the addtion of another order total module. Can you email or PM me the code you have for checkout_process.php?

 

There are upgrade files from 1.4->2.0->2.1. If you want to do 1.4->2.1, then just do the database changes in the 1.4->2.0 upgrade, then do the database changes in the 2.0->2.1 upgrade. Then follow the install instructions for 2.1. Of course, I didn't write the install or upgrade instructions with 1.4->2.1 in mind so it might not be as easy as 1.4->2.0->2.1.

 

Thank you for answer. I haven't see the upgrade from 1.4 to 2.0 because i only downloaded ot 2.1.

 

I sent you my checkout_process file.

 

Thanks ;)

Share this post


Link to post
Share on other sites
I don't think you'll run into any problems. The coupon code affects mainly how OSC handles order totals, so it should be happening "after" the quantity price breaks. Of course, I'd recommend setting up a test site to test it out first.

 

Once I got round to manually changing the required files and seeing which these were, the "after" the quantity price break you mentioned made a lot of sense! So no conflict with the quantity price break contribution at all... :thumbsup:

 

Seems to work perfectly so far, thank you kgt for this great contribution!

Share this post


Link to post
Share on other sites

Hi Thanks for this Contribution - not sure where I have gone wrong but I have installed the 2.1 contribution and amended existing files manually and then installed the Reports item. I get these warnings on my website! Can anybody point me to where I have gone wrong Thanks J

 

 

Quote //kgt - discount coupons define('TABLE_DISCOUNT_COUPONS', 'discount_coupons'); define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders'); //end kgt - discount coupons

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/xxxxxx/public_html/catalog/includes/database_tables.php:64) in /home/xxxxxx/public_html/catalog/includes/functions/sessions.php on line 97

//kgt - discount coupons define('ENTRY_DISCOUNT_COUPON_ERROR', 'The coupon code you have entered is not valid.'); define('ENTRY_DISCOUNT_COUPON_AVAILABLE_ERROR', 'The coupon code you have entered is no longer valid.'); define('ENTRY_DISCOUNT_COUPON_USE_ERROR', 'Our records show that you have used this coupon %s time(s). You may not use this code more than %s time(s).'); define('ENTRY_DISCOUNT_COUPON_MIN_ERROR', 'The minimum order total for this coupon is %s'); define('ENTRY_DISCOUNT_COUPON', 'Coupon Code:'); define('ENTRY_DISCOUNT_COUPON_FREE_SHIPPING_ERROR', 'Your order total is now below the free shipping minimum.'); //end kgt - discount coupons Unquote

Share this post


Link to post
Share on other sites
Hi Thanks for this Contribution - not sure where I have gone wrong but I have installed the 2.1 contribution and amended existing files manually and then installed the Reports item. I get these warnings on my website! Can anybody point me to where I have gone wrong Thanks J

Quote //kgt - discount coupons define('TABLE_DISCOUNT_COUPONS', 'discount_coupons'); define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders'); //end kgt - discount coupons

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/xxxxxx/public_html/catalog/includes/database_tables.php:64) in /home/xxxxxx/public_html/catalog/includes/functions/sessions.php on line 97

//kgt - discount coupons define('ENTRY_DISCOUNT_COUPON_ERROR', 'The coupon code you have entered is not valid.'); define('ENTRY_DISCOUNT_COUPON_AVAILABLE_ERROR', 'The coupon code you have entered is no longer valid.'); define('ENTRY_DISCOUNT_COUPON_USE_ERROR', 'Our records show that you have used this coupon %s time(s). You may not use this code more than %s time(s).'); define('ENTRY_DISCOUNT_COUPON_MIN_ERROR', 'The minimum order total for this coupon is %s'); define('ENTRY_DISCOUNT_COUPON', 'Coupon Code:'); define('ENTRY_DISCOUNT_COUPON_FREE_SHIPPING_ERROR', 'Your order total is now below the free shipping minimum.'); //end kgt - discount coupons Unquote

 

When the instructions say to add code, they do mean you need to add the code between the opening

 

<?php

 

and closing

 

?>

 

tags. Specifically, take a look at catalog/includes/database_tables.php and make sure there is nothing after the ?> tag.


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

×