Gift Vouchers RC1 and RC2

STOP PRESS: This contribution is now updated to Version 5 and has all sorts of cool extras. Please see the latest post about this.

Offering Gift Vouchers/Discounts is an excellent way to make sales, particularly on products where margins are high. A good example of this is “digital products” where (more than likely) margin is probably 100% of the sale amount.

By offering a 50% or more Discount Coupon, vendor is still making a good amount and the buyer has a bargain.

new client required the ability to offer Gift Vouchers and Discounts on the latest version of osCommerce which is called “RC1”. After having a hunt through the Contributions area yesterday, I could not find anything that was suitable in terms of;

  • usable on RC1
  • easy to use for “not web savvy” person
  • coded cleanly

So, I went back to the drawing board and coded my own – based on some work I did years ago. With just a few lines of code I’ve now got a really nice Gift Vouchers package suitable for the latest version of osCommerce.

It’s usable with RC1 and RC2 – I do have a MS2 version somewhere also. Anyone who wants it, please comment below and I will make time to turn it into a freely available contribution.

Added Screenshot showing Sort Orders (that work for me):

449 Replies to “Gift Vouchers RC1 and RC2”

  1. hi!!! thats exactly what i’m after!! your a legend!!! if at all possible i’d love this contribution… its exactly what i need πŸ˜€ GREAT JOB !!!!

    thanks again

  2. Sure, I’ll try and find time to get it found.

    If you upgrade to RC2a, you can have it immediately πŸ˜‰

  3. can i do that with a templated version?? as i tell you what i’d love to do it right away lol πŸ˜›

  4. I tried ur script. Unfortunately… it doesnt display the coupon code details and also doesnot apply the discount to the total on the confirm_payment page… ??? can u plz tell me what is wrong…

  5. Jenson – if it does not work, then most likely you have installed it incorrectly. Maybe missed adding some code, or did not set up the order_total correctly in your Admin section? Start Over πŸ˜‰

    Sasha – thanks πŸ™‚

  6. I have checked it with ms2, and I am sad to say that it is not working. First of all the discount does not show on the confirmation page. I noticed that even in the video this is the case, only after you click on payment method and confirm it again the coupon shows. Well this was not the case with my ms2 version, it did not show at all. Furthermore I tried to place another order right after I used the coupon for the first one. And for some strange reason I wasnt able to fill in a coupon number due to the fact that it said I already used one for that order. While in fact I did not use one for that order but the previous one.

  7. Good spot onthe “not showing discount in confirmation” though – I had missed that πŸ™

    All you need to do is remove the block of code from lines 85 to 106 inclusive of checkout_confirmation.php and move it to ABOVE the line of code that is;

    require(DIR_WS_CLASSES . ‘order_total.php’);

    Doh! No point calling the discount after the order_total. Good spot, thanks.

  8. And I also forgot a whole file – which is the cause of the other error. I’ll get a new package uploaded tonight sometime πŸ˜‰

  9. Even though it might not be for MS2 I still noticed the fact that in the video the discount did not show the first time you showed the confirmation page. Is it some kind of bug in the system or intentionally put there?

  10. Bert – yes, I forgot a file and made a mistake in 1 other file. I’ll repackage the fixes and upload. I might even port to MS2 at the same time.

  11. Hi!

    I’m interested in this. There are two other contributions with similar names, CCGV(trad) and Credit Class & Gift Voucher, which alters the Osc core files quite extensively, which is not good, how about this one? Is this new contibution of yours, built on these or is it a new approach to achieve the same thing? Would you mind elaborate a bit…

    You don’t happen to know whether it will play nicely together with Separate Pricing Per Customer 4.2.0 (SPPC)?

  12. KBK – this is a brand new approach to get (almost) the same thing. As far as I know, my version is simpler than the others that you mention. Mine does not alter much of the core code of osCommerce – only: checkout_process.php, checkout_confirmation.php and checkout_payment.php …

    What mine does not have is a system to email customers a voucher/discount code. For me, that is pointless so I did not code it.

    I don’t know if it will play nicely with SPPC – perhaps, you would post again here, if you do try it?

  13. Also, I’m on ms2.2 on which I’ve applied the patches for RC1 and planning to apply the RC2 as well. Will this be enough to use your contribution?


  14. KBK – should be fine. Just take it slowly and use the “already installed” folder rather than the “install on new”. The “install on new” is a bunch of drop in files for someowho has just installed RC. You won’t want that as you already have some contributions installed – and dropping in a new file might hurt those already installed contributions.

    In the “already installed” folder, you’ll see a bunch of folder and files. Any files ending in .php are OK to just upload as they won’t overwrite anything. Any files ending in .txt will need the code contained in them to be added to your pre-existing .php files of the same name. It makes sense when you see it πŸ˜‰

    It might be worth you installing a clean RC2 as a test site, then installing the drop-in files so that you can test the contribution to see if it’s suitable for what you need.

    Good luck!

  15. Hey,
    Thanks for this code, very simple to put in a very very modified osc. I have QTPRO installed and no problem with it (impossible with others big voucher’s contribs).
    Just one thing for others, you have to sort order “coupon” to “0” in order total module to see reduction in action. (one hour to understand:-( ).

  16. Gilles, many thanks for your feedback, I really appreciate it πŸ™‚

    I’m not sure about teh sort_order having to be zero – might that be somehting that’s in your shop only? I really don’t know…I added a screenshot to the original post (up there^) that shows sort orders that work nicely…at least for me!

    I’ll await more feedback on it, and see if anyone else has the same as you – and put it into the readme if needed.


  17. bonjour,

    My error after different tests was to order coupon after taxe. Before taxe, there is no pb.
    Sous-Total: 16.90 €
    Colissimo direct suivi (2 kg): 7.00 €
    Coupon (5%surmacommande) -0.85 €
    TOTAL TVA: 2.77 €
    Total: 23.05 €
    I have tranlate it for a french shop. Do you want code?

    Merci, Thanks

  18. Gilles – I would very much like your french translation – thank you. I will add it into the download on the oscommerce site. My email address is oscshops AT gmail DOT com – merci!.

    Léonie – thank you very much for your feedback. Nice t-shirt site you have there.

  19. me again πŸ˜€

    just thought i’d pop in and ask how the ms2 golden ticket is coming lol… cheers mate!! πŸ™‚

  20. On the Delivery Page, when I click on Continue, I get this error on the next page:

    1146 – Table ‘western_oscommerce.TABLE_COUPONS’ doesn’t exist

    select count(*) as total from TABLE_COUPONS where coupon_status = ‘1’

    [TEP STOP]

    I have this display order:
    1 – Sub Total
    2 – Coupon
    3 – Shipping
    4 – Total

    The table coupons and coupon_to_customer exist. The coupons table also has the
    information in it.

    Thanks for your help.

  21. Hi,
    I recently installed this add-on which I can’t wait to use as I think it is great!
    However when on my oscommerce, at the top of every page I recieve this error…
    Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at /includes/database_tables.php:133)

    AND… I can’t acces my admin control at all I just recieve this…

    Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at /admin/includes/filenames.php:70)

    WHAT CAN I DO???

    Thanks for all help in advance…

  22. From the Delivery Information page, when I select Continue, I get the following error:
    1146 – Table ‘western_oscommerce.TABLE_COUPONS’ doesn’t exist

    select count(*) as total from TABLE_COUPONS where coupon_status = ‘1’

    [TEP STOP]

    The table coupons does exist.

    Any help would be greatly appreciated.

  23. I love this.
    Seeing such a thing is one the moments when I wish I had become a programmer…
    it´s exactly what I was looking for.


  24. Craig – you need to make sure that you have added the name of the database table to the file admin/includes/database_tables.php

    Joey – you have made a common mistake. Make sure that you have no blank lines or spaces after the final ?> or before the first <? of includes/database_tables.php and admin/includes/filenames.php

    Joachim – so go download it and install it πŸ˜‰

  25. If that’s the first line of your file, it won’t work. Should be

    define(‘TABLE_COUPONS’, ‘coupons’);

    — remove the curly brackets.

  26. Just wanted to let you know that I got it working. I uninstalled and started fresh. I guess I missed somethiong before.

    Now that it is working, it was worth it. It is working great! Thanks.

  27. I was wondering if the wording “Discount Coupon” on the Payment Information page can be
    changed to “Member Discount”.


  28. Craig – good work πŸ™‚ You can change the wording in the language files -> /includes/languages/checkout_payment.php

  29. Unfortunately after getting rid of all spaces between these files I am still getting the following errors at the top of every page on oscommere:
    Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at x/catalog/includes/database_tables.php:58) in x/catalog/includes/functions/sessions.php on line 102

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at x/catalog/includes/database_tables.php:58) in x/catalog/includes/functions/sessions.php on line 102

    AND, in the admin panel, which is still in-accessable…

    Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at x/admin/includes/database_tables.php:49) in x/admin/includes/functions/sessions.php on line 102

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at x/admin/includes/database_tables.php:49) in x/admin/includes/functions/sessions.php on line 102

    Warning: Cannot modify header information – headers already sent by (output started at x/admin/includes/database_tables.php:49) in x/admin/includes/functions/general.php on line 40

    Can anyone help…
    Thanks a lot again!!

  30. Fixed the problem now but when I log into my admin control I get the following error now…
    Should I just do the same and delete all spaces??

  31. Yes I’ve fixed that one now but now have :

    Parse error: syntax error, unexpected ‘}’ in /admin/includes/boxes/customers.php on line 43

    On my Admin control and it all looks a bit out of place?

    Sorry for all the questions but i’m really in a hurry to sort this out, thanks again!

  32. Sorry guys its ok, I fixed it myself, I think that I put it in the wrong place to start with, but for some it may be best if you word where about to put it because that section got a bit confusing. May have just been me though!
    Great add-on!!!
    Thanks again!

  33. I thought I had it all done, but while testing, it seems that it is not changing any price. In the invoice or anyhting.
    Any reasons why this is?

  34. User Error when installing, most likely πŸ˜‰

    Make sure that you have set up your order_totals correctly.

    Sounds like you need 1-on-1 assistance πŸ˜‰

  35. Sorry my error sorted yet agin, I should look before posting here in future. πŸ™‚
    Anyway as I said before a great, easy to use add-on you have here, keep up the good work!!

  36. Hi

    I have installed this add-on to my oscommerce version 2.2RC2. After much testing, i have found that when a coupon is created and given to a customer to use, they can repeatedly use the coupon over & over, even when the coupon has been deleted, set to ‘once’ or turned-off! After the customer has entered the coupon code, they can make repeated orders with the same coupons discount. At the ‘checkout_payment’ page, it reads ‘A coupon has already been applied to this order’. At the ‘checkout_confirmation’ page, the discount is applied, even if the coupon has already been used, set to once, switched-off or deleted! Has anyone else experienced this same problem? Please help as to how to fix this.

    Thanks, Brad

  37. Brad – I just tested this and cannot duplicate your findings. I tried this on RC2 (a brnad new install) with my GV/dc contrib applied on top.

    Can you send me your store URL and a coupon code – to my email address: oscshops AT gmail DOT com


  38. Im afriad my site is not currently live. I have checked the install over 3 times and everythhing is exactly as it should be. Do you need to have any php functions activated?

  39. Nope, should work right out the box if everything is installed (and configured) correctly.

    Can’t help any more without trying it live on your server.

  40. I think i found the problem…i have been testing the add-on by confirming the order with PayPal IPN, and obviously not actually paying. Therefore the order never fully completes so the add-on thinks that the order is still on-going; hence why the coupon discount always stayed! I assumed as the order was placed as it showed in the back-admin. Does this make sense to you? Is the code set up to dispose of the coupon after the checkout_success page has been displayed?

    Thanks, Brad

  41. Brad – good thinking. The coupon is destroyed when the buyer hits “checkout_process.php” – obviously depending upon whether the coupon is a “once” or a “multiple” will determine whether they can use it again. Try setting up “cash on delivery” and see if you can recreate the error using that particular payment method.

  42. Success – testing with ‘cash on delivery’ now fully works. But do you know if the customer is returned to checkout_success after they have paid with PayPal IPN? Im not sure as i have never paid for something on my own site!

  43. WOW you are a busy boy admin!! lol… osc help/contributions are sniffed out and swarmed these days lol πŸ™‚ that is all ….thought i’d comment on the great work you’re …always nice to hear i feel πŸ˜€

  44. Brad – yes, the main order processing page is checkout_process.php and (as far as I am aware) ALL orders are passed through it at some stage.

    MK – thanks πŸ™‚


    Great mod but i have a tax-problem:
    1 – Sub Total: 200 Euro
    2 – Coupon: -20 Euro
    3 – Shipping: 0.00 Euro (Free)
    4 – Tax 19%: 38.00 Euro
    5 – Total: 218 Euro

    It has to be:
    1 – Sub Total: 200 Euro
    2 – Coupon: -20 Euro
    3 – Shipping: 0.00 Euro (Free)
    4 – Tax 19%: 34.20 Euro
    5 – Total: 214.20 Euro

    How to fix? Thanks!

  46. Hi, I’m just wondering if the coupon ties to a particular customer ID, or it can be used by any customer? Is it possible to make the coupon options can be set to:
    (1) be used by one or all customers;
    (2) restricted on some items or no item restrictions;
    (3) requires minimum order total or no minimum;
    (4) has expiration or no expiration.

    If your contrib can do those, it will be great. Thanks.

  47. Mike; my understanding is that a GV must be applied at the end price (otherwise you will be showing tax problems). Thus:

    Product: 200
    Tax @ 19%: 38
    Discount (10%): 20
    Total to Pay: 218

    Maybe in the next update I will look at the codebase for applying on the product price, after which discount is then worked out and tax applied.

    Taf; no such limits like that. Any customer can use the coupon on any product.

  48. Hey, yes it´s me again…

    Ehm I was just wondering, and
    think it would be a good idea
    to make it visible in the
    administration-area if a coupon
    has been used or even ensure,
    that it would “turn off” itselves´
    state of activity because that would be so handy to keep order…
    Ok just an idea…

  49. Hi,
    This contribution looks great. Just want I am looking for. I was wondering if you have the MS2 (for osCommerce 2.2-MS2) version ready yet.

  50. Joachim – that’s a good idea – but whether you select “once” or multiple”, the coupon never runs out. Once is once per customer, not just once in total.

    It would be quite easy to make a new page showing the uses of the coupons. Maybe in the next update.

    Girl – MS2 version is not yet started.

  51. This looks like a great contribution. Thank you!

    Unfortunately, I am having some difficulty with it: I’ve tried it on a v2.2RC2a local store I’m working on. I never see the coupon amount deducted from the total but the next time I do a purchase it tells me that the coupon has been used. I’m looking at your screenshot and I do not have ‘Coupon’ listed as an item in my Order Total. What did I miss?

    Thanks much!

  52. Hi,
    I’ve installed the contrib, and have it showing on the checkout_shipping.php page. Its using FEC with AJAX total update. However is not picking up the couplon discount. Any help would be greatly appreciated.


  53. FEC (Fast Easy Checkout for those no in the know ;)) is a contribution that makes the checkout process a bit less long.

    Alan – FEC makes too many changes to the core code – in other words, it’s poorly coded in relation to the osCommerce Code standards. What version of osCommerce are you using?

  54. Thanks Gary! Uploading /includes/modules/order_total/ot_coupon.php did the trick!

    I have an additional question: any thoughts on how I can complete the transaction while skipping going to PayPal IPN if the total amount (after the coupon) equals zero?

    Much appreciated!!

  55. Paul; RC1, RC2, RC2a at this moment. I might try to get around to making a MS2 version sooner rather than later.

    Francisco; I think this is not possible – have you had a hunt in the osCommerce Forum? Try “bypass paypal if payment amount zero” (or something like that).

  56. I was afraid of that Gary. Yes, I have searched quite a bit in the forums but will do more. Thanks for your prompt reply!

  57. Hmmmn. Thinking about it…

    The Coupon shows in the payment page – so you’d have to move that to a different page. Easy enough πŸ˜‰

    Then if the cart total is zero, skip the payment page.

    Then if the cart total is zero, don’t show the payment info on the checkout_confirmation page

    Then if the cart total is zero, make the button on checkout_confirmation go directly to checkout_process.php

    It’s quite a lot of work, but I think it is do-able.

  58. Thanks for the good input Gary! I did find a “Free Of Charge Payment Module” contribution that would work great but it does it’s check before one has the chance to apply the coupon. So if the amount is zero to begin with, the Free of Charge option shows up at payment time. I’m going through the code to see if I can identify where to change the order that the module kicks in. Any words of wisdom would be appreciated. Thanks much!

  59. Francisco – if I can find a bit of time over the next few days, I’ll see if I can’t come up with something. It’d make an interesting project!

  60. Paul – that depends upon how many contributions you have installed. If you have not done much with your Ms2, you would probably find it fairly easy to upgrade to RC2a.

    Or you can wait and I might find time to make a MS2 version.

  61. I just installed the coupon contribution. Everything seems to be working fine until i get to the checkout_confirmation.php page. It is not displaying the coupon or the discount? I went through the entire process again and double checked all of the code with the “install on brand new osc” code. Everything is identical. Does anyone have any ideas or suggestions?

  62. Hey whats up?

    my wife and i have installed your contribution, and been trying to work it in for the past 3 days, everything seem ok, just the last page order confirmation doesnt apply the coupon amount or show it, tried reviewing the code many times, and still nothing.
    could it be that since we have the seperate canadian tax line contribution installed its not working? but the amount should still apply right?

  63. I just realized what i did wrong. I needed to specify the sort order in the “orders total” within the admin section.

    Everything is working great now!

  64. On the Payment Information page, when an invalid coupon code is entered, at the top it
    says “You have entered an invalid coupon”. Can this wording be changed? (I would like it
    to say “You have entered an invalid Member number”.)

  65. sorry, this comes up

    1054 – Unknown column ‘p.products_subimage1’ in ‘field list’

    select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from products p, products_description pd where p.products_status = ‘1’ and p.products_id = ’28’ and pd.products_id = p.products_id and pd.language_id = ‘1’

    what can I do to get it to work?

  66. Hello Michelle – this error has nothing to do with the DC GV Contribution.

    Has your friend tried to install some type of “extra images” contribution?

  67. Before he installed it, we have had morepics 6 running with OSC 2.2 – can that be the problem and how do I solve it?

  68. Thanks for taking time to make a MS 2.2 version,

    Is it also possible to add a percentage discount coupon instead of an amount coupon?
    So a total of 10% etc. discount on the total of the next order amount.



  69. Text automatically translated from Italian

    I have installed your contribution … Excellent work compliments!
    One problem with taxes
    Application by:
    Sub-Total: Γ’β€šΒ¬ 30.00 EUR
    Coupon (provabis) – Γ’β€šΒ¬ 3.00 EUR
    PaccoCelere3 (price): Γ’β€šΒ¬ 9.10 EUR
    Taxes 20% VAT: Γ’β€šΒ¬ 6.00 EUR
    Total: Γ’β€šΒ¬ 42.10 EUR

    The fee should be:
    Sub-Total: Γ’β€šΒ¬ 30.00 EUR
    Coupon (provabis) – Γ’β€šΒ¬ 3.00 EUR
    $ 27.00
    Taxes 20% VAT: Γ’β€šΒ¬ 5.40EUR

    How can I fix?

    There is the possibility to exclude a category from discount coupons?
    Thanks for all the replies
    Sub-Totale: Γ’β€šΒ¬ 30.00 EUR
    Coupon (provabis) -Γ’β€šΒ¬ 3.00 EUR
    27.00 EUR
    Tasse IVA 20%: Γ’β€šΒ¬ 5.40EUR

    Come posso risolvere?

    Esiste la possibilità di escludere una categoria dal discount coupon?
    Grazie per le eventuali risposte

  70. Alexander – soon πŸ˜‰

    Valdez – this has already been covered, read the comments πŸ™‚ “There is the possibility to exclude a category from discount coupons?” – no.

  71. Text automatically translated from Italian

    Admin Thanks for the answer.
    I saw earlier remarks and I revived the question why
    Legigislazione the Italian plans to pay taxes in this way
    Sub-Total: Γ’β€šΒ¬ 30.00
    Coupon (provabis) – Γ’β€šΒ¬ 3.00
    Γ’β€šΒ¬ 27.00
    Taxes 20% VAT: Γ’β€šΒ¬ 5.40
    Total Γ’β€šΒ¬ 32.40

    Is there a solution?

  72. Hi there,

    having a problem, in the admin section it is showing as ” . BOX_TOOLS_COUPONS . ” .

    Obviously that link isnt working, but when i copy the hyper, this is what is copying – tep_href_link(FILENAME_COUPONS)

    any ideas?

    many thanks πŸ™‚

  73. Sunny – looks like you didn’t realise that the code needs to go INSIDE the brackets of the $contents[] array…it’s probably not too clear in the instructions.

    Just upload the file admin/includes/boxes/customers.php to overwrite what you already have.

  74. yeah im gonna have to, thanks for the help!

    ive got one more issue with my oscommerce, not a problem but something i need help on, is it ok if i email u?

  75. hi again monkey with a cocktail lol… will you announce when you get the MS2 version going? I hate sounding like a sook 😐

    .. just thought i’d ask so i dont have to keep asking lol.. saves you some sanity πŸ˜›

    i tell you what you have some fans going now… you need to hire lil monkeys with lil red hats to get back to everyone lol πŸ˜‰

  76. I am using PayPal IPN, but the discount is not being passed to paypal. Discount appears on the confirmation page.

  77. Hi,

    Having tried many credit/voucher contribs over the years, this one finally seems like the right one. But with a heavily modded MS2 codebase (no file left untouched) I’m dreading upgrading the entire shop.

    I’m happy to port this back to MS2 but would just like to know a summary of where you expect this code to clash with MS2. I have never looked at RC code so have no clue how different it may be.

    PS Used to live in Surbiton too πŸ™‚

  78. Hi Johan – I suspect that the code clash will be in the admin section only. I’m trying to find time to port it back, but it’s difficult as “real clients” have to come first – you know how it is!

    Cheers, Gary

  79. I have just installed DC GV on MS2-060817 and it installed without any problems! I’m surprised at that.

    I followed the instructions in the “shop already installed” folder very carefully – and it all appears to work as it should do!

  80. hiya again πŸ˜› so you telling us if we follow the directions under shop already installed properly we can use this mod on ms2?? ooow excited… cant wait as this is the last mod i want to install so i can go live… ooowww!!

  81. Well…it worked for me without any problem, using version 1.2 of the download (the latest one). Let us know how you get on.

  82. Hi,

    trying to install on a MS2, and get this error when clicking on ‘Coupons’ in admin.

    1054 – Unknown column ‘coupon_status’ in ‘field list’

    select coupon_id, coupon_code, coupon_status, coupon_type, coupon_amount, coupon_use from coupons limit 0, 20

    Any idea ?


  83. Thanks for this contribution. It was pretty easy to install, and works great. Unfortunately, I’ve just realized that I apparently can’t use it with Paypal express checkout because it ends at checkout_payment.php, before the coupon is applied.

    Do you know if there’s a way I can get it to work? Or can I just not use express checkout?
    Thank you

  84. Heather – probably a fair bit of work for you to move the code to another page, but I see no reason why it would not work if you got it all correct…

  85. I have a question about the checkout_payment.php file. Where do I insert the code that was provided by this mod. It doesn’t say exactly where to add this code. I must be missing something. Any help appreciated…..

  86. David – anywhere you like in that file so long as it’s in the “body” section πŸ˜‰ Have a look at the supplied checkout_payment.php file to see where I put it…

    Cheers, Gary

  87. Hi,

    I just finished installing your coupon module and LOVE it. It took about a day to install. Mainly because of an unfinished/failed attempt to install another “Discount Coupon Module”.

    I am using v2.2 RC1 with UPS Shipping Module installed. I had an issue with sending the discount over to the PayPal_IPN module but found if you set the Transaction Type to “AGGREGATE” it works fine.

  88. Isaac – thank you very much for your feedback – and thank you for the tip on setting Paypal to Aggregate πŸ™‚

  89. Hi,

    I was just seeing if there is a known I could try in order to get “Coupons” to show up in my OsCommerce v2.2 RC2 admin section please.


  90. Hi Gary,

    this is Ron again. I compared files for customer.php in the two folders you have for “new install” and “old install” and found the problem. Thanks again.

    I still would like a better understanding of how to change transaction for Paypal to an Aggregate please.


  91. Ron – good work on comparing those files – it’s the easiest way to see any problems…

    The Paypal aggregate setting, is I think, in the Paypal Module itself. If you go your Admin, then to your Paypal payment module and edit it, you should find a selection of r “aggregate”.

    Cheers, Gary

  92. Hi folks,

    my english is not as well as i needed it for understanding this whole site, so please sorry if i’ve misunderstood something.

    I want to install your conrib into an existing MS2.2 shop and it would be very helpful to know, if your version is working there or if (and when πŸ™‚ you’ll make a special contrib for 22.

    This contrib is looking very nice and there are a lot of other voucher- contribs full of bad code…


  93. Tom – your english is much better than my german πŸ˜€

    This should be OK for MS2 – I have tested it personally in MS2-060817 and it worked fine.

  94. Heather – there is an easier way – you can pay me to do it πŸ˜‰

    Unfortunately what you want is a fair bit of work and these free contributions are really a “one size fits all” deal.

    If that size doesn’t fit you, then you need a bit of bespoke tailoring…hope that makes sense? Gary

  95. Hi again,

    i tried out some configs in between and now its working very fine. My problem wasnt in a code, i just did not set the sort order of the module to 0 like gilles found out.
    When you install it in the admin area, its in the order 1 by default and then it does not show the amount in the checkout area.

    Its working with MS22 if – like you said – you use the “shop already installed” version of the setup wich is no problem and done very fast at all.

    You’ve done a great work with this, perhaps you could write this sort problem into the readme.txt and then its perfect for MS22 users to.

    Best Regards

  96. Hi,

    I installed the contribution on my ocs just now. I am having only one difficulty as I am not to sure how to use the SQL file.

    I am getting this error

    1146 – Table ‘’ doesn’t exist

    select count(*) as total from coupons

    Any advice on how I run the file, Step by step would be great! πŸ˜‰

    Thanks you in advance,


  97. That seems to have done the trick.

    I now have a different problem:

    I can enter a coupon code in the checkout but it is not deducting the value from the order.

    Any ideas?

  98. Sorry to bother you again,

    but just noticed that the Coupon option is not there.

    Maybe this has something to do with the problem?


  99. It’s ok, I fixed it.

    When uploading ot_coupon.php there must have been an interuption somewhere.

    I noticed the file size was very small so i uploaded it again and it works just fine now.

    Thanks for your time anyway, much appreciated πŸ™‚


  100. Cheers on an amazing contribution. I am really impressed with how you built your code on the OS Commerce core and simplicity. In contrast to some similar modules, you only two tables — fantastic. Works great — loaded on my website with some modifications. I think the other modules attempt to get too fancy rather than making sure the basics work. Thanks again.

  101. Hi there your Gift Vouchers RC1 and RC2 module very good. However there is one thing that i am facing which is when a customer of mine did a purchase a copy of the purchase was not notify or send to his mailing address.However i do receive the notification or email that he has make a purchase in my web mail.

    Before i install this Gift Vouchers i do not face this problem i suspect that i could type wrongly in some of the files.

    Could you kindly help me by advising where the problem will lies. Could it be the files checkout_confirmation.php.

    I am really can you help! Thanks!

  102. Teo – there’s only a few files you’d need to check. The best idea is for you to go over them again, making sure to make any code changes as carefully as possible.

    Good luck – Gary

  103. Great add on. Had some issues but like you said just keep trying. Read this blog
    and found all the answers I needed. Wanted to make a comment that my coupon works
    when customer clicks Paypal and checks out (Using Paypal Express Payments and OSC rc2a)
    though so don’t know if that will help Heather.(Also, I only tested in sandbox, haven’t
    gone live yet!)

    Kudos to you! Thanks a for a great site too btw! Learned a lot from you and I
    didn’t know anything before I started a week ago.

  104. Hi Gary,

    I’m using PayPal IPN v2.3.3 with a RC2a store. I’ve read and re-read the posts and tweaked my settings accordingly but I can not get the discounted amount to go to PayPal. Each time the total (without the coupon discount) goes over. I wonder if there is code that should go on the paypal_ipn.php file.


  105. BTW, I do have the transaction type set as “Aggregate” for PayPal. Also I have the Order Total set: Sub-total (1), Coupon (2), Shipping(3),Tax(4) and Total(5). Anything obvious I’m missing?

  106. Hi Francisco – the problem is that the Paypal IPN 2.3.3 that you are using is a poorly coded piece of crap that doesn’t stick to osCommerce coding rules! I will try to find time to correct the code errors in the 2.3.3 code.

    You could take a look yourself – the problem is with the way that the “amount” (to pay) is worked out (2.3.3 version is working it out completely incorrectly!)…

    Cheers, Gary

  107. I’m sorry to hear this Gary. Do you have any advice for me? Is there an IPN version you think is better?


  108. Francisco – have a try with this module, which is a direct replacement for what you are already using, in /includes/modules/

    Zip link

    I make no guarantees that this will work, but it certainly looks better than the coding mistakes that are already in there! Test it out 100% to your satisfaction before using it in a live shop!

  109. Interim testing update:

    (1)paypal_ipn.php [v2.3.3] passes total amount (w/o deducting coupon) to paypal
    (2)paypal_ipn.php [Gary’s replacement] takes the coupon amount from the total but adds shipping twice before sending to paypal.


  110. Francisco – in my version, try changing all instances of;



    $order->info[‘total’] – $order->info[‘shipping_cost’]

  111. Francisco – thanks πŸ™‚ I updated the .zip with that change. If anyone else downloads it, I would highly suggest to fully test it out before using it in a Live Shop!

  112. Hi Gary,
    what a great contribution, it seems to be a very easy solution!
    I only have 1 Question: How do I make sure the Voucher gets deducted from the total? All else seems to work fine, but the amount does not get deducted. The rest (amount of vouchers/creating voucher/etc) works.
    My osc isr 2.2 RC1.

    I would really appreciate your help, Gary.

    Thank you in advance!

  113. Frank – you need to specify the sort order in the “orders total” within the admin section. See the image at the bottom of the original blog post (up there ^)…Gary

  114. I’ve a problem: discount isn’t removed from order total… checkout confirmation says:

    Discount coupon (abcefg): -0.00 … but i set it to be fixed amount 10 Swiss francs.

    I use fast Easy Checkout, and I applied all checkout_payment modifications to checkout_shipping.php … I use osc MS2060817

  115. Luca – “I use fast Easy Checkout”

    There’s your problem – FEC makes too many changes to the core code of osCommerce. However, I suspect that parts of the coupon functionality can be recoded to deal with the FEC codebase. But that’s something that will certianly not come cheaply – if you are interested please get in touch.


  116. Just need a hint where to look … get this when the browser goes to checkout_process.php. It is identical to the new version in your files.

    1366 – Incorrect decimal value: ” for column ‘value’ at row 1

    insert into orders_total (orders_id, title, text, value, class, sort_order) values (‘4’, ‘Coupon (uflorida)’, ‘-$1.50’, ”, ‘ot_coupon’, ‘3’)

    [TEP STOP]

  117. Craig – for some reason your codebase is not transferring the correct “value”. Could be for any number of reasons, hard to say without seeing your live codebase – for which I would charge appropriately (in other words, don’t post a load of code here as that’ll do no good) – it needs further in depth investigation. I’d just start afresh if I were you.

  118. Harmonie – it works with MS2 – just make sure to follow the installation instructions closely, and if you run into trouble refer to the “install on brand new” instructions to see wht you have done wrong.

  119. Thanks Amy
    Maybe we’re not using the same payment module? I’m using the “PayPal Website Payments Pro U.S.” mod which includes Express that comes with OSC. There is no way for the coupon to be applied as the page where the code is entered is as far as one can go when checking out with Express, thus the coupon doesn’t get entered…..

    Maybe I just need to choose another Paypal mod? It’s confusing, as there are 3 that come with OSC, and tons more on the mod site. Why are there so many, anyway? sigh….

  120. hey,

    I spent over 3 hours with ‘another’ voucher contribution before finding out it doesn’t work with v2.2 RC2a.
    Yours took 15 mins to install and after I remembered to set the coupon sort order to 0 it worked a treat.

    Thanks loads.

  121. Need some confirmation here.. I am using :
    osCommerce 2.2 – MS2, PHP 5.0.4, MySQL 5.0.15-nt

    Is it ok? already installed at test site. However, get this in Admin –> Coupons:

    1064 – You have an error in your SQL syntax;
    select count(*) as total from coupons limit -20, 20;

    These coupon should apply to certain product or ..?

    Can u help me? TQ.

  122. after i install it, the admin workds, when i place the order works, the when i checkout, the discount is not applied, dont know why that happend, can someone help me?


  123. Kenod Rosario – you have not followed the instructions 100%. Most likely you have not set the coupon sort order in your admin area. If you have, then just start over, and if that does not work, see this post.

  124. hi Gary,
    thanx for the good work, respect! i have a question: i need a german language file, do you have one? or do you know where can i get one?

    Thanx and greetings from berlin-germany

  125. Hey Eso – to fix this up, take the whole /includes/languages/english/ folder of the contribution and rename the folder to “german”. Upload! Then do the same for the Admin section…

    Then you’ll have a lot of english words witin your german section, so you’ll need to translate them and change the appropriate english words to german words.

    It’s not difficult – just takes a bit of time. If you do translate the files, please send them to me at shop AT oscbooks DOT com and I will add them to the contribution. Thanks.

    If you cannot manage to get it working with German, I can help, please see here – I would have to use Babelfish to make the translations though.


  126. Hey Gary,
    it’s a wonderfull idea, thanx. why i get not self to this way? i dont know… :-). Of course, when i take the time and will be finished with the german translation i will send it to you! thats the way how it works with free contribs i think!

    greets E

  127. Hello Gary,
    its me again. the german language problem i have done, an in the moment it looks good. but i have a generaly problem with the video.

    by the start of the video you klicked in the admin site of the left menue on the 4th link from top, it calld by me “customers”. Then the 3rd link of this category is in the video “Coupons”. By me the last link is “orders”. Do you understand me, there is no link “coupons” the create one…

    have you got a idea why?


  128. Eso – it’s because you haven’t followed the instructions πŸ˜‰

    Take a look at the code for the “install on brand new” folder – particularly the files; admin / includes / boxes/ customers.php – and compare it to what you have live in your server…you might see a difference..

  129. well, looks like i dont found in the .txt where say that i need to change order of coupons :S

    reading this post i found the answer πŸ™‚

    Thanks the contrib works OK.

  130. Hey RK – no worries – now you got it sorted πŸ™‚

    For anyone else in the future having trouble seeing the instructions, it’s in the “Usage” section of the readme.txt

  131. Hi Gary,

    Thanks for the contribution. For the online shop, yes it works. Great!!

    However for the admin site, actually I’ve done those modification before, but it didn’t work for me. Never mind, for the time being, I can manually alter the database.

    TQ so much for your work!!

  132. I have to say that this is one of the better thought out Contributions that I have worked with.

    I like the approach to minimizing the impact to existing code and only ran into the trouble with the sort order until I came over here.

    Very well done and thank you. I love the simplicity in the design.

  133. Mama – you should be able to fix that problem up easily – make some more investigations in the forum about it and you might find the answer. If youy wanted me to fix it I can, but I would charge you to do so.

    Jerry V – thanks πŸ™‚

  134. hey man… m working on a site for a computer shop… my oscommerce version is v2.2rc2a…
    i used ur latest solution for vouchers coupons…. but the problem is that i am not getting any error now… but when i finally checkout to process the order it refreshes to the first page again… and nth else happens… can u tell me y???
    i m using paypal direct and express payments… its urgent and necessary…
    waiting for reply… if u can mail me the solution thats will be more fine…

  135. Works a treat, great work. I went down the shop already install route for this install, the only small problem was putting the code in the right place in catalog/checkout_payment.php as i found out it needed to go under

    at about line 317
    if the code is put anywhere else on this page the coupon shows up at the bottom of the payment page and not the middle.
    Other than that this is a great mod. Thankyou for your time and effort.

  136. Awesome job! It would be good that when the coupon is applied to the order, the shopping cart total is automatically recalculated and displayed. From your demo, it looks like the client has to double-check that the gift cert was applied and for what amount.

  137. Felisa – the coupon is applied and is seen on the “confirmation screen”…the demo is a bit outdated πŸ˜‰

  138. Hi Gary,

    It’s me again. Just to say that everything work for me. Just now I am on my way to modify it little bit so that it will meet my requirement.

    Is it possible that only selected item get the discount, and also the discount is apply to all quantity for item A.

    Example: Only item A get 20% discount, and if the customer buy 3 item A, each item A he will get 20% discount.

    Any suggestion where should I start? Thanks..

  139. Mama – what you need is quite complicated. It’s certainly possible.

    My thought would be to have all the “allowed” products in an array – then check the customer cart to see if any of the products in his cart are also in the array. If yes, place the discount against the products that are in both.

    See what you can come up with. I can take a look at coding something for you, but it’ll be expensive…

  140. Is it possible to make coupons only re-deamable on orders over a set minimum order value?

    Look forward to any replys

  141. DR – yes it is, but not as part of the base code of the contribution. You’d just need to amend the checkout_payment.php page to only show the coupon input if the cart_total > X … It’s not a lot of work. Good luck!

    If you want me to quote you for this, email me on


  142. Hi, just downloaded the coupon voucher. One question though.

    IN the Catalog/checkout_payment txt file you have the following code, but it doesnt tell me where in the checkout_payment.php it needs to go? Can you help? thanks Joe

  143. Joe – compare that file to the file that is inside the “install on brand new” – πŸ˜‰

    If you have troubles, I have an installation service.

    Cheers, Gary

  144. Gary,

    Thanks for the post for help. One question more. We got v2.2RC1. Will your contrib work with it? Cause the Voucher/Coupon selection isnt coming up. If it does Ill have to reinstall it to make sure I got all the changes made.



  145. Nice contribution. Wish I could use it. After installing and realizing I’m not using RC1 nor RC2 I spent the next day and a half upgrading my site only to find out that this contribution does not work with a previos contribution I installed, namely Fast Easy Checkout (,3469).

    Can anyone help me and tell me how I can get these two excellent contribution to work with each other.


  146. Steve – FEC makes too many changes to the core code of osCommerce. However, I suspect that parts of the coupon functionality can be recoded to deal with the FEC codebase. But that’s something that will certainly not come cheaply – if you are interested please get in touch. Gary

  147. Hi Gary
    Installed this on RC2a under wamp. Works and easy
    Wondering if you plan to generate the coupon
    code automatically in the future.

    Also, any advice about using the GV part of the addon?

  148. Coopco – the GV part is more than likely to be a paid upgrade (when I get around to coding it). Automatic coupon codes would be part of that.

  149. Gary,
    V2.2 rc2. installed your formula in a new OS then I get this
    Fatal error: Cannot redeclare class soapclient in /home/saspreci/public_html/Amadeo/includes/classes/nusoap.php on line 7239

    Any rescuing Idea,


  150. Deo – nusoap class is not a standard part of osCommerce and is definitely not in my contribution. Start over?

  151. I am interested in this,
    not sure which version of OsCommerce I am using.
    I think its an older version around 2005.

    Can you please send it to me

  152. Gary,
    I start over and all works great.

    If I Create a GIft Certificate for $ 25 as one of my item
    and assign coupon code to it. How can I avoid shipping charges
    to it.

    e.g. customer can buy $ 50.00 gift certificate and I will
    e-mail them the discount code but there should be NO shipping
    Charges to it.



  153. Hi,

    Is there a specific place to insert the code under catalog/checkout_payment? (This is from the already installed shop text file).


  154. Deo – give your product a zero weight, which should then bypass the shipping.

    Camille – compare it against the file that is in the “install on new” folder.

  155. Hi Gary, the contrib sounds great and I’d like to install a copy on my MS2.2 site. From reading your postings it appears that you now have a version that will work on MS2.2, so is there a place where I could download it from? It looks like on the site that this one isn’t the correct one for MS2.2
    Hope you can assist.
    Regards Rob.

  156. I have installed the complete package and all is good except when I get to the order confirmation page it has not applied the coupon. I set one up that can only be used once and that all works. once you have completed an order with that coupon it will not allow you to use the coupon again. I just cant get it to discount the price.

    Thanks for the contrib!


  157. Gary,
    2 things(re: no shipping).
    1) my shipping is according to the $amount.
    2) How can I prevent discount to my Gift Certificate.



  158. You cannot prevent that as the discount is based on the order total. Of course, it can be added to a future release, or you can have a go at coding it up yourself.

    In the future, I intend to upgrade this contribution with all sorts of useful stuff such as;

    – start date for voucher
    – end date for voucher
    – exclude products (or include products) from being discounted
    – ability to purchase a Gift Voucher, and have it automatically create a PDF for the buyer to print off and give as a gift to someone else.

    But all of these are sometime in the future.


  159. I have fixed that by moving it to the line above, the error has gone at least.

    I have a new problem with the coupon not showing at all in the payment pages. I have checked all through the above and it seems that the most likely culprit is the sort order, I have tried it on zero and as you have it in the screen shot without effect. I am assuming seeing as no further errors are showing that everything is in place as it should be.
    Any ideas?

  160. I have changed around the sort orders and it still isn’t showing, could it be anything else?. The admin side works exactly as it should be and the coupons are showing in phpmyadmin.

  161. Chris – it’s hard to say – maybe an incompatibility with some other contribution, or with a different setting in your Admin area. Or, something else entirely. I presume you followed the install instructions exactly – if so, it should just work on a “normal” osCommerce…

  162. Thanks Gary, I have added a few contributions but nothing too complex, define mainpage, a thumbnailer, server timezone fix, cross sell and quantity drop down.
    I was a little unsure once or twice where to add the code additions but checked with the new install files and followed them without any trouble finding the relevant info. I will have start checking them all again.
    Odd that one side should show ok and the other (catalog) does not show at all.

  163. Problems with taxes,

    I have tried to move the order total module to place 4. but still the price is wrong.

    This script does not subtract the coupon before adding tax.

    I have read through this post, some other people have also noticed this. Is there any solution? Could it be possible to add Tax Class to the coupon module?

  164. Erik – certainly possible – it’s why the source is open code πŸ˜‰

    It’s something I intend looking at sometime in the future – paying projects come first (unfortunately).

  165. Erik – that’s a nice offer thank you – I don’t (at the moment) have the time for such a large amendment of the codebase – you are most welcome to post up on one of the “free lance” sites to see if someone can update the codebase to deal with Tax – then maybe you would contribute the changes?

    Alternatively, you can try my buddy Brian in the osC Forum – he is a great coder and might be able to help sooner than I can..

  166. I can’t believe it happened again.. Nice and simple looking coupon solution wich has not been finished again.
    Why are there so many contribs without correct tax calculation out there?

    Every voucher/coupon/discount contrib without working tax calculation is useless..
    Thanks for nothing.. Sorry but its just frustrating to install it just to find out about the tax issue again..


  167. “Thanks for nothing”

    You are VERY welcome. The source is open, go ahead and make it work. You got what you paid for. Be thankful for that.

  168. I apreciate your work, but you realy should not post it to the contributions area in that state or just mention that this contrib does not re-calculate any taxes and will always take the order total or something. I know that this is free etc pp
    Just see it from my point of view. I have changed the code of my shop for it just to see that it does not work. So i can now just accept that my php code stays that way with useless code or reverse all changes.. or make a shedule for every day to look back here to hopefully find the changed and working script some day.

    If i could do it, i would fix it my self.

    Have a nice weekend!

  169. Stephan – you have no idea what “Open Source” means. If you got your wish that no-one contributed anything unless it was perfect, then osCommerce would not even exist. Before you post again, THINK about what you are going to say.

  170. i know that open source scripts (as most commercial products) are never realy finished and 100% bugfree and that every user is seen as a developer. everyone can improve the script, fix bugs, help out with documentation etc.

    I was just wondering why the tax calculation has been left out again and was upset about it as it seems most coupon/voucher script coders forget about it.

    I’m out.


  171. Hi, I purchased a oscommerce template that came already with the gift/coupon voucher module installed, I am able to create/email or even give new members gift cards after sign up, but I can not figure out how to sell gift cards via my catalog can anyone point me into the right direction?

    thanks chad

  172. Stephan – you’re out. Not much more I can say.

    Chad – I think that the template would not include my DCGV contribution as standard – but it might do. You need to contact the template provider and ask exactly what Voucher contribution is installed – once you know this, you’ll be able to get more help.

  173. Manny – you can go ahead and download the files at the osCommerce downloads section, or to get the new updated version that includes tax calculations see here. The latest version is available at this moment only as an installable (by me) service.

  174. Well guess what – i installed this on (a heavily modded) MS2.2 and it works just fine! did you update it for that already? i was really expecting to do some down and dirty code editing but no. above gilles (feb 17) about the sort order: well I got that too – but it was to do with the sort order being set the same as another module’s sort order. Make sure its sort order is distinct and all is good. just what was required half hour job thanks Gary! (ps i’ll see what all that tax cafuffle is about next!!)

  175. Rupe – good work. I believe that this is the easiest “discount contribution” to install. I noticed the other two discount contributions have support threads that re 50 or more pages long.

    It’s been OK for MS2 since day 1 – I just never tested it until later on…

    Cheers, Gary

  176. sort oroder thing: not a problem with this mod – seems to be inherent with ms2.2 just dont set anything to 0. the tax thing – ifyou are happy with applying the coupon after the tax then it aint a problem – i guess some customers might perceive that they are paying (slightly) more but hey they got a discount! thanx again for the work.

  177. Hey

    You mention the ‘install’ service but don’t say how much you charge.

    I have installed your mod, and it works. Well it nearly works…

    I can place an order, enter the code. Get the discount. Pay.. ALL PERFECT

    then on my next order I get a coupon has already been applied message… So I can not enter a new coupon etc…

    So how much for you too re-install this? I have followed the instructions and just don’t have time to ‘play’ as its on a live store..

    Send me an email…
    Cheers Alan

  178. Hi Alan – from what you have described, the coupon session is not being destroyed. Look at checkout_process and make sure you have the following towards the bottom;


    If this does exist in the file (and it is in the right place), then it will need more digging to find the answer.

    I charge £25.00 to install this contribution – which guarantees it works or you get a refund. And it does not matter how modded your store is. I’ll make a new blog post showing my charges.

  179. Hi there – this looks great. I have started installing it and ran into a problemthough.
    I made the changes in Admin, then went into admin to check it.
    Most of the menu options in Admin had gone. No customers etc, down to three menu items and no info on the screen! I have uninstalled in admin and its back to normal.

    Have I edited the files wrong, or am I using a wrong version for this…or any other suggestions?

    Thanks so much!

  180. Kells – if you did it correctly there should be no problems. I offer an installation service should you require it.

  181. I just retried the install on the admin side and have run into the same problem. The admin are now only has “confugiration, modules, and the top menu item. I can’t see order or customers. I have removed the text but it hasn’t fixed the admin side. Do you know which file could be causing loss of menu on the admin area? If I can just restore that then I might consider having it installed for me – just a bit desperate to get back into admin.

  182. Oh never mind I think I solved it myself – how do you see which version of OS you are using? Maybe its not compatible.Was installed this year.

  183. Okay I have installed it completely. When I go into the admin side and select “coupons” I get the followng error:

    1146 – Table ‘’ doesn’t exist

    select count(*) as total from coupons

    [TEP STOP]

    I’m sure its a quick fix but how do you do that?

  184. Kells, you have not run the SQL file in PHPMyAdmin. It creates the database tables that are used by the coupons.

  185. Hello. I complitely installed that mod on a rc1 v2.2.

    On a checkout_payment.php , it asking to enter coupon code, but on a last page before payment(checkout_confirmation.php) it doesn’t make any changes. The price is without any discounts. How can I fix that problem? Thank you

  186. Hi Gary, installed this contribution and I can’t see where I have made an error, rechecked and clearly missing something as when I go to check the sort order I get this error code- ( x’s I exchanged here for public viewing)

    Cannot redeclare class ot_coupon in /includes/modules/order_total/ot_coupon.php on line 13

    A hint to where I made the mistake would make my day.

    Many thanks

  187. Hi (another) Heather πŸ™‚

    Check that you do not have a backup of ot_coupon in the directory that it is telling you;


    eg: ot_coupon.phpBAK or similar.

  188. Hi Yuriy – you have not completely installed it as you made the same mistake that loads of other people who did not read the instructions. Read the instructions again, paying close attention to the “sort order” bit.

  189. Yuriy – no email received. Email me again and I will get back to you with a price and what I need to install for you.

  190. Hi Gary

    Checked that and nope, nadda, not another thing remotely similar lol! Typical eh?

  191. Yuriy – found your email (in my spam box :() and replied.

    Heather – best option is to uninstall and reinstall, or if you have a bit of a budget I can take a look for you. Email me on oscshops at gmail dot com if you want to take that route.

  192. Ok dokey, I shall have another go at it and then will give in and mail you LOL! I so want to figure stuff out and so far I have mainly but somethings just confuse me πŸ˜‰ Good job I have 3 months to launch date πŸ˜€


  193. Gary, Great work! I think there is an error when calculating CAÒ€ℒs tax and total in the Order total Modules. I sorted the order in different numbers that applies in the admin/order total modules, the CAÒ€ℒs tax and total are incorrect. See actual sample items below:

    Camo Backpack 79.95
    Sub-Total: $79.95
    CA TAX 8.25%: $6.60
    Coupon (123) -$5.00
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    Total: $91.94

    This sample applies taxes to item before discount, no tax on shipping. The total is incorrect.

    Camo Backpack 79.95
    Sub-Total: $79.95
    CA TAX 8.25%: $6.60
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    Coupon (123) -$5.00
    Total: $91.94

    This sample applies taxes to item before discount, no tax on shipping. The total is incorrect.

    Camo Backpack 79.95
    Sub-Total: $79.95
    Coupon (123) -$5.00
    CA TAX 8.25%: $6.60
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    Total: $91.94

    This sample applies taxes to item before discount, no tax on shipping. The total is incorrect.

    Camo Backpack 79.95
    Sub-Total: $79.95
    Coupon (123) -$5.00
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    CA TAX 8.25%: $7.39
    Total: $91.94
    This sample applies taxes to item after discount, no tax on shipping. The total is incorrect but CaliforniaÒ€ℒs BOE requires tax on the sale amount before any discount. If you are California residents, your sale taxes are incorrect.

    Camo Backpack 79.95
    Sub-Total: $79.95
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    Coupon (123) -$5.00
    CA TAX 8.25%: $7.39
    Total: $91.94

    This sample applies taxes to item after discount, no tax on shipping. The total is incorrect but CaliforniaÒ€ℒs BOE requires tax on the sale amount before any discount. If you are California residents, your sale taxes are incorrect

    Camo Backpack 79.95
    Sub-Total: $79.95
    Coupon (123) -$5.00
    United States Postal Service (1 x 7lbs) (Priority Mail): $9.60
    CA TAX 8.25%: $7.39
    Total: $91.94

    This sample applies taxes to item after discount, no tax on shipping. The total is incorrect but CaliforniaÒ€ℒs BOE requires tax on the sale amount before any discount. If you are California residents, your sale taxes are incorrect.

    Any idea how should I fix the error. Thanks for a great work! Pam

  194. Pam – this version does not deal with Tax – that’s why the total is slightly out πŸ˜‰

    The latest version does, but this is an experimental version which needs to be installed by me. Throw me an email on oscshops at gmail dot com and we can go from there.

  195. By the way – it appears that in your examples above, Tax IS being charged on shipping at 8.25% – check to make sure.

  196. Thanks for the contribution Gary, I was floundering until I realised you had to ‘install’ it in the order_total section of admin. Looks like a few hit this, I think it’s ‘cos you decide on option 2 in the readme and believe that’s all there is to it without realising there are more steps. All working now.

    Is it possible to add an option to make a coupon useable once only rather than once per customer? In a gift voucher situation you don’t really want the voucher useable once it’s been redeemed if someone else was to get hold of the number.


  197. Greg – that’s certainly possible. Just needs a portion of the contribution recoding – maybe something on the to-do wish-list (which is getting longer day by day) ;p

  198. Thanks Gary. I’m sure you’ve got a number of additions to make but from my little knowledge of coding I imagine (hope) it would be a relatively simple addition to the existing structure which would extend the contribution’s functionality significantly, rather than building a whole extra module (such as the ‘only for certain products’ which I think is a great idea but a lot more work). If you get the chance to have a look at it I’ll be first in line to test it! πŸ™‚

  199. Greg – some of the stuff that people have been asking for is “interesting” to say the least. I’m only coding stuff that is useful for the majority, not the minority (unless the minority pay for the pleasure – and most of them don’t want to). What you want is something I can see that would be useful – but when I get around to it is anyones guess.

  200. Hello and great work my friend.. I just wondering if you are planning to make any addon that will make a feature to let customers buy those codes like a products, and give them to their friend.. That will be great if you make it..

  201. hey mate,

    i have tried to install the contribution and started with the admin side, i have changed all the text and uploaded all the files and when i go into the admin panel i get a plank page!

    any ideas as to what i have done?!


  202. hi dude,

    you recently replied to my message on the osc forums when i asked about discount codes. problem is, i’ve followed it all through and everything ‘appears’ to be working, as in, i dont see any errors anywhere, BUT at the same time, on the checkout page i dont see any discount applied?

    can you help?



  203. Shelton – uninstall and reinstall. Follow instructions closely, INCLUDING the “usage” instructions. If you don’t able to get it working, I offer an install service.

  204. Nice contrib – easy to install, but have one issue that I didn’t find in the posts preceeding.

    My installation uses for CC validation, and we incur a charge for every transaction. This is the only payment method.

    I install GV&DC, and want to give away some product promotionally, so I can set the Admin to use a voucher 1 time, and set the discount to 100%, and the sale totals correctly, but because I’m using, I’m getting charged the transaction fee.

    How can I adjust in Admin, or in the code, to allow a 100% discount without the transaction fee?

  205. Roger – I don’t have any experience with so cannot help you, sorry. Couldn’t you enable a different payment method if the voucher amount is 100% ? See here for more info.

  206. Hey Gary,

    I have installed the contribution and followed your instructions carefully. I am getting no errors whatsoever, but the discount is not reflected in the total. I had no problems running the SQL in PHPMyAdmin. I double checked and made sure all files were added/modified correctly. I only had to modify 1 file (includes\languages\english.php) and that modification was very simple. The rest of the files were replaced and all the new coupon php files were added. I double checked and all the files have been uploaded, but still no discount in the total. Any idea what the problem could be? I am running MS2-060817, which you said it should “work fine.” Please help.


  207. Mike – read instructions, particularly “usage” instructions. If you need it, I offer an installation service. Email me.

  208. H, I have downloaded the discount coupon codes, but after extracting the files, the site is
    still not working nor any column for discount ode an be seen.
    Please help by guidung step by step to include the discount at the payment mode.

  209. lynda – read instructions, particularly “usage” instructions. If you need it, I offer an installation service. Email me.

  210. Hi there, this is a good contribution, installation is straigt-forward. I have a couple of questions though. Do you think for a future version, you may add functionalities such as restricting the amount of use by customers, currently it’s once per customer as perhaps “this voucher is applicable to the first 200 customers”. In addition can you you assign a voucher to a certain category, such as “Motherboards”. Furthermore, can you put an expiration date on certain vouchers. That’s it. Regards Elroy

  211. Elroy – thanks for the suggestions;

    “restricting the amount of use by customers” – probably not.

    “assign a voucher to a certain category” – definitely not.

    “expiration date on certain vouchers” – yes, that’s coded but whilst coding it I introduced a bug that needs to be solved.

  212. By clicking the “Confirm order” at my site, bring up a blank white page. There is no error or whatsoever.

    I have latest version. even uninstalled and reinstalled.

    Any ideas would be appreciated.



  213. Installed incorrectly. As you’ve already tried a couple of times, you might like to have me install it. My email address is up there ^

  214. Thanks. Now am looking for possible error. Did remove and still error. Now am looking at previous mod. Will get back after results.


  215. Hi, I need help with the Parse Error.

    Parse error: syntax error, unexpected ‘)’ in /home/memoriez/public_html/catalog/admin/includes/boxes/customers.php on line 28

    Please help!


  216. Hey, thanks for the initial code, i have tried several ccdv mods with no luck. I have found a silly problem with the code. It seems although i apply a percent coupon it discounts as a fixed coupon. For example

    Sub-Total: $49.99
    CA TAX 8.25%: $4.12
    Coupon (10%OFF) -$5.00
    In-person Pickup: $0.00
    Total: $44.11

    Quite peculiar i know. Is there a particular file i may have switched these two associations? Perhaps the database tables? Your help is greatly appreciated. Thanks in advance.

  217. Adoncia – take a look at the code for the “install on brand new” folder – particularly the files; admin / includes / boxes/ customers.php – and compare it to what you have live in your server…you might see a difference..

    Dennis – 10% of 49.99 is 5 (rounded up).

  218. A couple more tests, it seems the coupons are being doubled and deducted. The fixed vs. percentage works great. Which file might be calling this deduction twice? TIA

  219. Thanks for the prompt reply Gary and your support, sorry to flood your board. Im thinking maybe my problem is with the database…would that make sense? Im going to get some sleep and try to figure this out in the morning. πŸ™‚

  220. Hi Gary,

    I used the code in the “install on brand new” folder. However, the link doesn’t work. Can pls assist?


  221. Adonia, follow the parse error instructions. There must be an extra ‘)’ in your code that you did not remove. Start looking on line 28.

    Gary- This may be a long shot, but might the discount amount be doubling because it is applied as euros? My subtotal is in dollars so is it calculating 1 dollar = 0.5 euro??

  222. Adoncia – as Dennis rightly says, work your way through the codebase until you find the error…

    Dennis – shouldn’t make a difference as the modue is independant of currency issues. Make sure that the discount is not going into the database twice.

  223. Is there a reason this is packaged like Admin folder then catalog
    shouldnt the admin folder be in the catalog?

  224. Ray – only if you have your shop set up like that. Admin files go in the admin section and catalog files go int he catalog section – regardless of where it is installed on your live site. I’d suggest that a majority of live shops don’t use a /catalog/ folder anyway!

  225. After installing this contribution, it shows the following
    error message at administration/customers/coupons.


    Coupon Code Coupon Status Action
    1146 – Table ‘’ doesn’t exist

    select count(*) as total from coupons

    What should I modify it and make it function. Thanks.


  226. Wow this is a flawless contributuion, we use a heavy moded 2.2 MS2 it took me a little bit, I had an OLD coupon.php lingering that never got replaced so i had some tep errors and I then relized all files might not been replaced or updated, I took a good look and double checked it all and made the replacement and BANG@!

    Works great

    thanks a bunch

  227. I’m not sure how many beers u will get for 50 bucks, enjoy your weekend keep up the good work

  228. I have encountered the following error

    1366 – Incorrect decimal value: ” for column ‘value’ at row 1

    insert into orders_total (orders_id, title, text, value, class, sort_order) values (’36’, ‘Coupon (abc)’, ‘-RM8.01’, ”, ‘ot_coupon’, ‘3’)

    in checkout_process.php. After checking the codes i notice in ot_coupon.php the the value was set to empty.

    (‘title’ => TEXT_COUPON . ‘ (‘ . $_SESSION[‘coupon_code’] . ‘)’,
    ‘text’ => ‘-‘ . $currencies->format($coupon_discount, true, $order->info[‘currency’], $order->info[‘currency_value’]),
    ‘value’ => ”);

    Could this be the cause of reason the SQL is set to ”


  229. Chong – could be any number of problems. I suggest to re-install – the easiest way is to create a new test shop and just install the brand new files. Alternatively, uninstall and re-install – but this is usually not fruitful as if you made a mistake, you are likely to make the same mistake again.

    Go over your files with an eagle eye.

  230. Gary,

    I have installed the files and run SQL with phpmyadmin. When I was setting up the coupons in the oscommerce admin section, everything seemed to be going fine. I was able to create a coupon, and install the coupon in the order total module. However, when I went to do a test transaction, there was not a field available for me to enter the discount coupon code. Its seems nothing has shown up. Then when I tried to continue the transaction, I ended up at a blank checkout confirmation page. Any idea what my problem is? Ive tried reinstalling the coupon code, but still have the same problem.

  231. Dave – definitely a dodgy install. Keep trying, and if all else fails, know that I offer an installation service.


  232. Dave – shouldn’t make any difference – this contribution is written specifically for RC release of osCommerce…

  233. One little thing I found with this have no idea why. I have installed this mod on 2 different sites.One site 2 times installed it. (both are with the same host.) But for some strange reason I had to re test the codes a couple of times then bingo would show the discount being used.. Would take about the 3rd code I used that it seemed to kick in. Like the site gets stuck remembering how checkout was then fixes up to how it should with the discount.

  234. Cass – sounds like an issue with session – check you added the session start on the correct files.

  235. Gary, great job thanks for your efforts.

    I have read through the entire forum and notice a lot of people have the same issue as I, which is you can enter the discount coupon, however on the Order Confirmation page, the discount is not shown INITIALLY. If I press F5 and reload the page, then upcomes the discount. Of course following the order through, it works perfectly, ie shows up on my invoiced etc.

    I am testing osC 2.2rc2a on my localhost, and have placed the Coupon Order Total Modules in Sort position 1 to ensure its calculated first.

    I have noticed above and in the forums, that people also have had this problem with a similar contribution GVDC. I have double clecked the code to ensure I have made no errors, and as it does work correctly I assume I havn’t made any mistakes.

    Do you have any ideas / hints as to why the applied discount is not Initially shown.


  236. Troy – session is not registering – you need to make sure you added all the session bits and pieces to the checkout files.

    For anyone having problems, I offer an installation service. Guaranteed to work correctly or you pay zero.

  237. I just installed this on a fresh RC2a – works wonderfully.

    The only problem I’ve noticed is that you cannot remove a coupon once it has been applied to an order. Is there any way to do this?

    I enter the code in, but no matter what I do (empty cart, log off, etc.) I cannot pull it off the order… what if the customer changes their mind? There is no way to un-apply it.

  238. I can think of a whole bunch of reasons, lol.

    1.Customer forgets how much coupon is good for – just wants to apply and see, then remove for use later.
    2.Customer decides he wants to give it to someone else, but can’t pull it off.

    There are more. But it just seems that to be “user friendly” and to keep people from getting frustrated, there should be the option to remove it from the current order.

    I look at it the same as when a person puts something in their cart to see the final price w/shipping. Just because they are looking at how much it costs doesn’t necessarily mean they will buy the item (or in this case use the coupon).

  239. Sethman – I guess that makes sense.

    Alternatively, an idea might be to have an input box infobox where the person can check how much the coupon code is worth without having to go thru an entire order?

    Whichever way, it would probably make a good upgrade for the future πŸ˜‰

  240. Gary – Great addon! I love it!

    Just a quick question. I cant see a place in the admin section to see whether the coupon has been used, is there one?. I was looking at the coupons.php to see if I could add a column next to the coupon status saying ‘Coupon Used’ and either yes or no, or a 1 or a 0, or something similar. Would this be an easy thing for someone to show me?

    Many Thanks

  241. Milo – at the moment, coupon use is seen in each individual order. It shouldn’t be difficult to make a “coupon used” column, but it’s not something that’s useful for me, so I wouldn’t make it as part of the contribution. I suppose if someone wanted to sponsor development of that part then it would be possible to find some time to make it.

  242. Gary – Okay, thanks. Ive not been using php that long, or even at all. I can read it but cant write it. I will see what I can do and if any success I will post the code here (if you want me to).


  243. Milo – great, go ahead πŸ™‚
    Wordpress doesn’t like code being posted in comments, but feel free to email any code you come up with and I can add it to the contribution maybe. My email address is up there ^

    Cheers, Gary

  244. After spending weeks messing with another discount coupon contribution I came across this and have installed it but ran into a problem – no matter what I do I cant get it to actually apply any discount (% or fixed) to an order. Im using COD as the payment type for all orders and have one coupon code set up – when I enter the code and click continue it shows up in the information as Coupon (correct coupon name) but a value of zero. Likewise in the email confirmation the same information is passed but no actual discount applied.

    Im using FEC and I *suspect* maybe this is part of the issue – the code which you said to insert into checkout_payment in the instructions I put into checkout_shipping instead as FEC doesnt use checkout_payment but that code is mostly just HTML with a few if statements to check if the coupon has been used before and shouldnt make a huge difference (famous last words……)

    Any ideas at all? From memory and looking at the code I dont think FEC makes a huge number of changes in checkout_confirmation where the discount is not being applied so not sure where to turn :/

  245. Hmmmmm well I would (and I actually only installed it because I couldnt get PWA to work and FEC was a very definite second choice) but I really do need the functionality it offers as I know from previous ecommerce and OSC experience that a lot of customers associate signing up for an account with getting buckets of spam and it does tend to put people off buying which I obviously want to avoid!

    As a matter of interest, does your code work with PWA? The issue I have with PWA is there are no intructions how to install it over a modified OSC instance – just the replacement files are provided and as my store is heavily modded I couldnt even begin to try and compare the files manually to find out where to put the code etc πŸ™

  246. Hi Gary,

    This coupon is a nice contribution. I did email you about a problem with paypal express.

    Basically, when using paypal express to checkout the coupon code is not deducted from the order. Paypal standard works fine but paypal express takes you to paypal and then back to the store and that’s where it gets messed up.

    If I’m missing something please let me know.

    Thank you!

  247. Hi Melinda

    Paypal express cuts out (part of) the checkout process, so any contributions which are coded for checkout will not work.

    It’s a possibility that the coupon code could be activated prior to checkout (say on the shopping cart page), you can have a go at recoding it?

    Cheers, Gary

  248. Gary,

    Super contribution it works perfectly and does exactly what is says on the tin!

    I do however have one problem which I am trying to eliminate. Using PayPal IPN I dont get any order confirmations and all the issues that go with that (stocklevels, cart not emptying etc.) I have read that if any changes are made to checkout_process.php they have to be duplicated in paypal_ipn.php and ipn.php. Your program is the only mod I have that changes checkout_process.php, so I am wondering if:

    1. Has anybody else come across this issue?
    2. If they have what is the solution?
    3. If 1 or 2 dont apply, do you have any ideas on what I am doing wrong?

    Thank you in advance.


  249. Ian – thanks πŸ™‚

    Some of the Paypal stuff does bypass areas of the checkout. THe coupon contrib doesn’t touch many files so it should be easy to work in.

  250. I don’t have “admin > customers > coupons”

    Its present at “order total modules”

    in the OSC forums I’ve replied to you, but I have to contact my host.

    any ideas right now?

  251. Mark – if you don’t have a “coupons” link in your customer box in your admin area, then you have not installed it 100%…so my advice wouold be to go back over the install instructions and see if there is anything you have missed. I offer an install service if you cannot go forwards with it – if interested please email me, my email address is up there ^

  252. Hi Gary, I have the MS2.2 version of osCommerce and would love it if you could email me a version of your Gift-Vouchers contribution to install on my store. Many of the others I have looked at require other contributions to be first installed, and don’t seem to be as simple and logical as yours appears in the video.
    In anticipation, Rob.

  253. Gary – I have my site set to use free shipping for all orders over £50 but as the coupon is applied AFTER shipping is calculated it means that some customers are getting free shipping when they shouldnt be as the coupon takes them back below £50.

    For example, if the order value is £55 before any coupons are applied and the customer then uses a 10% coupon the order value is now £49.50 which shouldnt qualify for free shipping but they still get free shipping as the new order value only kicks in at the last stage of the checkout. Any ideas how to overcome or work around this?

  254. My current sort order is:

    Sub Total

    and it still doesnt work properly – might try and put coupon first and then sub-total and see if that works…..

  255. The coupon is applied only to the order_total, so the shipping should kick in on the order_total. Hence I would say that it is possible that my codebase is incorrect or that the free shipping module codebase is incorrect…

  256. I have added GV and DC RC1 RC2 RC2a v1.2 coupons > how ever find that upon using a fixed amount coupon, transactions can turn negative, is there anyway i can set a minimum order value for the coupon to be used.

    Currently if the sale is for $3.99 and the customer has a $5 coupon the sale turns negative.

    Any ideas on how to get around this would be great


  257. A minimum order value is a good idea. I’ll add that onto the to-do list – when I get around to it is anyones guess πŸ˜‰

  258. Hi, please can you email me the Discount Coupons install for the older 2.2 MS2 version of oscommerce

    thank you


  259. Wondering if this contribution is what I need. I need to be able to purchase gift certificates and redeem them online for my store. My client also wants to be able to add a discount to one item and take a percentage off an item not the entire order.

    Does this contribution do that? Thanks!

  260. hey i can’t seem to find the coupon module anywhere and everyone here seems quite satisfied with the job you’ve done can you please send it to me pleaseeeee

  261. Is this add on trackable? In other words itÒ€ℒs been used 200 times during Sept or whenever. Can it be auto applied via a click through a newsletter or something like that?

  262. Steve – Version 2 and Version 3 of this codebase has a feature whereby you can click a link to see all uses of the coupons.

    Image (usual view):

    Image (detail view – you can see links to each order):

  263. I’m installing this add on to an already set up store, and am not quite sure exactly where to put the ‘checkout_payment.txt’ into the ‘checkout_payment.php’ file. I finished all the other mergings, and the last few had specific instructions on where exactly to place the new code. The ones that did not contain specific instructions were pretty self-explanatory

    This one is a little different though; if I put it at the end, all the processing has been done. If I put it in the middle, I’m unsure if it will work…

    Please help!!!


  264. Hi, i installed the module onto a ms2.2 store after reading your email. All is fine but the discount is not applied to the order at all.

    everything else is working, any ideas on how i can solve the problem.



  265. Hi,

    I’m just wondering if you would be interested in allowing my contribution to this project. You see, early on you had someone requesting if your contribution plays nicely with SPPC Separate Pricing Per Customer, well it does. I am currently running SPPC and your contribution on my website without any problems. It took me a while to figure exactly where to put some of the codes, but i managed to do it. If you update some of your txt files so that the average joe doesn’t have to do a hunt and peck to get it right it would be appreciated. Anyhow awesome contribution;)

  266. Rob – good work! – I prefer that you package this up yourself and maintain it etc. Cheers.
    If you do package it up, please make sure to call it something completely different so that users do not get confused and come here for support on yours and vice versa.

  267. Hi Gary,

    Great contribution! I’ve installed it and it worked nicely.

    May I suggest something that you can add for coming releases. Is it possible to incorporate a ‘return customer’ discount method into your current system? I’ve seen some contribution on that (the ‘Easy coupons’ with automatic coupon option)and I hope you could add something like that into your contribution.

    I don’t want to have multiple discount system in the shop as it will probably cause trouble and hard to organise.

    ps. Your discount contribution and how to is the most user friendly discount contribution out there. Others are so hard to understand and execute.

  268. Ayman – what you would do is create a permanent discount code, on a “use once” basis. Show this code when they log in…or maybe have it in the email that is sent when they make a purchase.

  269. Gary,

    Yeah, i do thought of doing that. But, wouldn’t it be troublesome when you have a big number of customer that you need to keep up with? Knowing who shopped more, who first time buyers are and who are your loyal customers could be very confusing.

  270. Hi, first thanks for this contrib, really good stuff!
    I have installed in the site, and for some reason its causing a bug with my credid card check out proccess, works fine with paypal, but when i choose the CC processing that i use a linkpoint contrib(that was working before i installed the coupons contrib)
    i’m using v2.2 RC2a and basically when the order goes through the linkpoint process but its not going in to the cart admin…it acually goes through linkpoint and charges the card, but the order is not showing in os commerce. any ideas what could be causing this?
    Thanks for you time!

  271. Great contribution, thanks!
    Question: What would be the best approach for adding a second GVDC box so that customers could receive a discount AND redeem a gift certificate? Can I simply repeat the installation so that two discount boxes appear and both a discount and gift certificate can be applied to an order? Do I need to rename the second installation so there is no confusion during checkout? Also, is there any easy way to NOT allow certain items to be purchased with discount codes (i.e. gift certificates)? I have my gift certificates set to not have sales tax applied to them. Could I use a similar approach to not allowing the discount codes to be applied to a particular item?

  272. Jonathan – having more than one discount would make price and tax calculations very complex. However, I see no technical reason why you could not have more than one discount at a time – would take some coding skills but shold be doable…

  273. hello, Thank you for this contribution. Since is my first contrib. install.
    i set up the coupon on the admin, but when trying to buy a product it comes up
    at the bottom of the checkout_payment or(payment information) type the code* click continue to next page Checkou_confirmation.php or (Order Confirmation)
    I see Sub-Total: $70.00, Flat Rate (Best Way): $5.00, Total: $75.00 But
    Don’t see the code discount in this page.(i did install in admin-order total module coupon! What have i missed? It does not show up like in your video sample. Also using RC2a

    Thanks πŸ™‚

  274. when u are done ‘ don’t forget to check the ordertotal module and have the orders correct, my coupon didn’t come up at checkout bc of that’ !
    Great Contribution!

  275. Good work Hanna. That’s the exact problem that 90% of those who say “it doesn’t work” need to check on.

  276. Hello, quick question.

    When the customer adds a coupon, and goes back to the payment page it says “A coupon has already been applied to this order” How would one go about making that message say like. We have several different coupon options from percents to cash.

    “A 10% coupon has been applied to this order”
    “A $5 off coupon has been applied to this order”
    and then after that message, a button that says “Click to remove this coupon” in case they want to choose the percent over the $5 off.

  277. Hank – with this coupon contribution, only 1 coupon may be applied to any order. v3 has the facility to remvoe a coupon after it has been applied, see here, however v3 is unavailable to the public at this point as one portion of the codebase (that deals with tax) needs to be set up on a store by store basis, hence I install it at low cost.

  278. A rather enticing add-on, I have gotten it into admin and the space for discount code is showing on checkout and have completed a transaction.

    However, on checkout the USPS module (the original USPS module included with v2.2 RC2) is now broken and giving the old “An error occured with the USPS shipping calculations.”

    The demo site was in-sync with the live site via shipping options, so I did not know if this was something that came up before. I realize it makes no sense.


  279. Hi, I’m desperately looking for a discount add on for my site. Someone from another forum sent me here.

    Thanks so much,

  280. hwkd – it shouldn’t affect any shipping modules as the coupon system affects only the order total. Unless of course your shipping is based on order_total!

  281. I’ve installed it 4 times and everytime got the same problem: when I click on coupons in clients, I’ve got ‘Access failed . Any access is not valid!
    Please ccontact the administrator of the site in the event of problem of access’

    I’m working on 2.2 MS2.

    Thank you for your time.

  282. I have installed GV DC RC1, RC2, RC2a V1.2

    Tried it and it did not apply the discount, just kept the same price. In admin it doesn’t say $’s, could that be the issue? I do not have any currencys except $’s and English installed

    GV DC RC1, RC2, RC2a V1.2

    Coupon Type
    Fixed: amount in £s & pence
    Percent: percentage discount
    » Fixed

    Coupon Amount

  283. Chuck – it should not matter about the currency.

    Denis – I have not seen that error.

    Both – take advantage of my installation service. Guaranteed to work or you pay zero. Contact me on

  284. Hi, works fine for me accept when i use a payment module by a third party provider. The total sum without the discount. How can I code this my self? They do something like this to get the total

    $order = new order;
    $pay_cents = number_format($order->info[‘total’] * 100, 0, ”,”);

    I would like to deduce the total with the discount total. How can I extract this?

    Many thanks…


  285. This contribution rocks! Hell ya! Seriously… I have tried ALL of the other GC/GV options available, and none have worked until I found this one. Excellent! Where do I donate?


  286. Tomislav – the module changes the total, so your payment module should pick that up. If you test it using a different module (eg, cash on delivery) does the correct amount (including dicount) show. If so, then you know you have to fix the 3rd party payment module…

  287. Hmm… i think its to the third party module which has its problems. Do you by any chance have any suggestions on how I can extract the coupone amount for the order?


  288. i’ll send you a copy, but what I am missing is something in the classes/order so I can extract the coupon value if its possilbe…


  289. Hi Gary, I installed your contribution on my OSC-RC2a and it looks like it’s all working, Yeah !!!! You’re a genius, ’cause I certainly am not in this field and I got it working with your instructions !!! I’m over the moon!

    The only question I have is that in the admin/customers/coupon field there is a mention that the value amount of the coupon is in Pounds and pences (or percentage, so I choose this option now) I am in NZ and would need Dollars. can I change this ??

  290. Hi Joyce – you should be able to change this in the language file; /admin/includes/languages/english/coupons.php – it’s only text and should not really be there at all. in subsequent versions of this (it’s now at version 4) this has been removed. I’m about to blog about Version 4 later on today.

  291. Oops, celebrated a tad too soon. All is working in Admin and looks all in the right place, but then I go to check out and the two last pages are all broken up. I must have done something wrong merging the .txxt files in the checkout_confirmation.php; checkout_progress and checkout_payment.php files, but what?

  292. Joyce – could be any number of things. Copare your files against the files in the download. Not the txt files but the other php files. That should allow you to see the problems.

    Note also that I offer an install service should you need it – installation is presently v4. Installation is cheap and guaranteed to work or you pay zero.

  293. Hi,
    You module sounds like the one i have been looking for. I have RC2a and MS2. My current site is ms2 but i am updating the site to RC2a

    Thank you

  294. Gary GMD is back πŸ™‚

    I installed this for MS2 and i got it working so I tought, well the order history, email and everything shows the correct amount but the Paypal Pro – Direct Credit Card still charge the full price.

    I dont mind to send you some more beer $$ if you can help me out

  295. GMD – lots of payment modules are incorrectly coded. If you try a different method (eg cash on delivery) you should see it working OK – assumes of course that you installed it OK πŸ˜‰

    So, what you need to do is see how the COD method grabs it’s “total to pay” and see how the paypal does it too – then correct the paypal one…

  296. Gary

    Of course cash on delivery works, the cart works and hold all information corrct based on discount, on admin side, and customer side the problem is the data that sends to paypal,

    I sent you an email I think i need your help here, last time I sent you 50 bucks beer and I would love to contribute some more..

  297. HI Gary,

    Thank you for all your work and help, looks like a great contrib.

    I would like to try to install this myself. I have a couple questions.

    I do not know PHP very well, I have managed to install quite a few contribs and can customize OSC pretty well but I am a real greenie, so my question is where to insert the code from the text files into the php files of the same name? most of the define lines seems pretty easy to put anywhere, but the other code for the other pages it does not seem apparent where I should insert the code.

    Next, does this contrib work with other common payment modules like

    Thanks for your help.


  298. Hi! I’ve just installed discount coupon codes and i’m unhappy with it.
    I’m curious about this, is it able to exclude some manufacturers from the discount? So each manufacturers on my shop can set their own discount? (freelancers) if not, are you planning to implement this?


  299. Andreas – I have no plans to implement anything like that.

    Jacson – if you download the package from the contributions area, you will be able to see the thing installed on a clean version of oscommerce (install on brand new) so that you can compare the files. I offer an installation service should you need it.

  300. Hi,

    Been looking at this contrib and have a quick question. We are currently doing some party plan stuff (selling at peoples houses at parties) and have a number of “agents” who do this for commission. They want to advertise the site aswell and wanted to know if I use this contrib can I issue each of them a voucher code for “their” customers which I can track when it is used and pay them futher commission for repeat business??? i.e a voucher give 10% to the customer which I can then track orders using that voucher?



  301. As asked by someone else earlier — I can not figure out how to sell gift cards via my catalog can anyone point me into the right direction?

    Please let me know

  302. Tai Kahn – You would make a product, and then once a person buys it, you would make a gift voucher to equivalent value and let the buyer know the gift voucher code. That’s not automatic, obviously.

    Now I have the “coupon” side completed, I can carry on and make the “gift voucher” side (so it is all automatic) – I’ll make a blog post about this in the next days.

  303. Looking forward to the automatic method. My customers want to buy a gift certificate and check out, and never call and have it emailed to their son/daughter/etc for the holidays.


  304. Hi Gary,

    There is nothing for download at that link, it just says to contact you if you need this. Should i email you?

  305. Hey Gary, nice work! But I got one problem. I need to show the included Tax of 19% (Germany) from the Summary and not the Tax from the Product.
    What I want is this:

    Product 100.00 $
    Shipping 10.00 $
    Coupon -50.00 $
    Summary 60.00 $
    incl. Tax 19% 9.58 $

    I got in the moment this the incl. Tax from the product, but this is wrong, need show the Tax from the Summary (please also the bills in the admin must show the above example:

    Product 100.00 $
    Shipping 10.00 $
    Coupon (1002) -50.00 $
    Summary 60.00 $
    incl. Tax 19% 19.00 $

    Please help.

  306. George – this version does not support tax calculations. I have a “working with tax” version, but it needs tweaking from shop to shop hence the need for an install by me.

  307. Hi Gary,
    can you give me the working with Tax version pls, I have to install it of my own because the shop is already running and the shop owner don’t want give access to server to foreign people. I will donate your work, if it is the solution I’m looking for. How much you want for the solution and installable documentation?

    Greets George

  308. i downloaded GV and DC RC1 RC2 RC2a v1.2, even thing is ok except one thing, when i try to check out i get the following error

    Warning: Cannot modify header information – headers already sent by (output started at /home/******/public_html/user/classes/boxes.php:912) in /home/user/public_html/includes/functions/general.php on line 40

    I think this problem occured because of the followinf file before the header

    function tep_count_active_coupons() {

    $coupon_query = tep_db_query(“select count(*) as total from ” . TABLE_COUPONS . ” where coupon_status = ‘1’”);
    $coupons = tep_db_fetch_array($coupon_query);

    return $coupons[‘total’];

  309. Hi Gary,

    Many thanks for the contrib, it is exactly what we have been looking for.
    I have a couple of queries though:

    1. I took great care over the installation, and believe that I completed it correctly as stated by the instructions (performed an offline and online installation, both with the same results).
    Is it correct that when a discount code is entered and the customer presses continue, even if they don’t complete the order, and may even log-off, when they come back (and log-in again) to make a potentially different order, the code is automatically still active, and it is stated that a coupon is already being used for this order?

    2. Prior to installation, orders were not appearing in the orders section of Admin, or the order history area of the customer’s My Account, until Confirm Order was pressed (and in the case of my site, they are transferred to Paypal for payment). However, it now seems that the order comes through as soon as the customer reaches the Payment information stage of the checkout process(where the result of the coupon and resulting total is first displayed).
    Could this be a result of the installation? And could you suggest how this can be fixed so that the order is only sent through when ‘Confirm Order’ is clicked?

    I would be happy to elaborate further via email if necessary.

    Many thanks,


  310. Paul, easy answer – compare the file against the other in the download – see previous comments in this thread. Cheers, Gary

  311. Mark;

    1. Possible – you need to destroy the session.
    2. I don’t think that this is due the contribution.

    Cheers, Gary

  312. Hi Friend,

    I installed the gift certificate mod. it works good but the problem is it doesn’t show the calculated price after applying the coupon.

    I checked my installation 3 times and found it seems everything is fine. but still no luck with calculation.

    Please note I am currently testing it on my local wamp server.


  313. thanks for your reply Gary,

    Can you help me and explain how to enable order_total module and unique sort order?

    Thanks very much for your help.


  314. Hi,

    I got it fixed by enabling order total module and assigned a unique sort code too. Just one question.

    now it shows the total like this

    Sub-Total: $29.99
    Flat Rate (Best Way): $5.00
    Total: $34.99
    Coupon (123) -$5.00

    so the coupon amount is in minus and displayed after total price. that means the user wouldn’t understand if the total is still the same or reduced by the discounted price?

    Thanks a lot for your help.

  315. coupon works fine but still doesn’t calculate the exact total after discount. it just shows the discount on order confirmation but the total stays as without discount and same total is shown in admin/orders page.

    Also how does Gift certificates work? I basically want to sell gift certificates on my site.

    thanks a lot for your help.

  316. Hi Gary,

    Just wanted to say thanks for putting this together. It’s exactly what I was hoping it would be. Your install notes, and support here are perfect too.


  317. -=-=- Fix for “A coupon has already been applied to this order” -=-=-

    Ok, if you’re running a Paypal checkout and trying to get this (rather fantastic :)) mod running, you might be running into the problem that the coupons don’t delete themselves.
    This is due to the fact that Paypal doesn’t redirect you to checkout_process.php, it directs you to checkout_success.php.
    Simply take the code that should be in process.php, and move it into success.php, and the coupons should work fine πŸ™‚

    One problem i’ve run into though (not sure if it’s because of my ‘fix’ to the above problem?), everything works fine except I can’t get the coupons to only work once. I set them to single use in the admin, but I can keep using them over and over πŸ™

    This looks like a really great mod, it does exactly what I want it too, if you could just shed some light on why this isn’t working, would be much appreciated πŸ™‚


  318. Me again, just tested it and if i delete the coupon inthe admin section, I get a nice red box with “invalid coupon” when I try to use it, is there any way to get this to happen once they have been used once?

  319. Lewis – what needs to be fixed is the way that Paypal works (in relation to osCommerce). All finalised orders SHOULD go thru checkout_process…

    The contribution does not have a “use once, one time” coupon, however the latest version of the codebase does. Ther latest version is not available as a download, only it is available installed by me at this time.

  320. Gary, nice work. Quick question – if a buyer has two coupons (say a $10 one and a $20 one)and wants to buy something for a total of $30, is there a way of them being able to apply both coupons to the one purchase?

  321. Simon – in my version, only 1 coupon code can be input per order. More than this causes all sorts of problems with tax, sessions etc.

    So, your buyer with two codes would need to decide which one to use. In the latest version of the code, I have a “remove coupon” link which can be used to “test” which coupon they would want to use.

  322. Thanks for the prompt response Gary. Looks like my client will have to process this sale manually while I think of a way of adding functionality for more than one code. Or not!



  323. Hi Gary – and many thanks for the great contrib.

    In catalog/includes/modules/order_total/ot_coupon.php (about the line 44, at the end of $this->output[]… ) you wrote ‘value’ =>” so the value of the discount in the orders_total table always stays 0.0000.

    I have changed this to ‘value’ => 0-$coupon_discount to get the negative value of the discount, so that I can use the value in other calculations – for example sum the subtotal value and coupon value with a mysql command.

    Is there a reason why did you wrote the code in that way (‘value’ =>”)? I’m asking you because I don’t know osCommerce as good as you. Perhaps it is better to leave this value empty to avoid some complications on some other places in the shop?

    Another question: if a customer has typed the coupon code in the input field, logs out immediately after that (without buying), logs in again and wants to buy some other things (or the same things, it doesn’t matter), on the checkout_payment.php he will see the message: “A coupon has already been applied to this order”. I supose this happens because of the session that is still active. What do you think, is it a good idea to put your 4 tep_session_unregister(…) commands in the logoff.php file to avoid this?

    Many thanks

  324. Hi Gerard

    I can’t remember why I left that blank – having tested it, it seems OK with the value in there. so I would say to use it with the value. I’ll update the codebase.

    Yes, in v5 of the codebase I have the unregisters in logoff.php – put them towards the top underneath the other unregisters, and before the tep_redirect

    Cheers, Gary

  325. I just installed your contribution and it seemed to be working great but them I noticed that on the checkout_confirmation page it applies the coupon amount twice. It’s odd because it applies it only once on the previous page checkout_payment. I’ve been going over all the code looking for where it might be doubled. Any suggestions would be greatly appreciated. I’ve already scoured the checkout_confirmation page.

  326. Hello Gary.

    Thank you for yet another great contrib…

    I just installed this last night, and happened to come across the same issue as Gerald above. By chance, what are the 4 sessions that need to be unregistered during logoff, in the event that the customer does not finalize the transaction?


  327. Rob

    There are 4 or 5 tep_session_unregisters somwhere in the code in checkout_process.php. As well, add them underneath the other unregisters in logoff.php

Comments are closed.