Gift Vouchers RC1 and RC2

By | February 11, 2008

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 thoughts on “Gift Vouchers RC1 and RC2

  1. Gary Post author

    Oh, when/if you comment, please let me know whether you require RC1 or RC2 or MS2 version. Thanks.

  2. misery_kitty

    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

  3. Gary Post author

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

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

  4. misery_kitty

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

  5. Jenson

    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…

  6. sasha

    this looks really neat, my brain nearly exploded with the other complex ones

  7. Gary Post author

    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 πŸ™‚

  8. Bert

    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.

  9. Gary Post author

    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.

  10. Gary Post author

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

  11. Bert

    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?

  12. Gary Post author

    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.

  13. Pingback: Club osCommerce » Version 1.1 of Discount Coupons and Gift Vouchers for RC osCommerce

  14. kbking


    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)?

  15. Gary Post author

    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?

  16. Gary Post author

    Oh, it also has a couple new functions – but nothing major.

  17. kbking

    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?


  18. Gary Post author

    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!

  19. gilles

    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:-( ).

  20. Gary Post author

    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.


  21. gilles


    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

  22. Gary Post author

    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.

  23. misery_kitty

    me again πŸ˜€

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

  24. Gary Post author

    Gilles – thank you very much!

    Mike & MK – I’ll get around to it, need to find some free time πŸ˜‰

  25. Craig

    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.

  26. Joey

    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…

  27. Craig

    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.

  28. Joachim

    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.


  29. Gary Post author

    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 πŸ˜‰

  30. Gary Post author

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

    define(‘TABLE_COUPONS’, ‘coupons’);

    — remove the curly brackets.

  31. Craig

    My mistake, the first line is as you said it should be, they are ( ), not { }. But still have the error.

  32. Craig

    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.

  33. Craig

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


  34. Gary Post author

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

  35. Joey

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

  36. Joey

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

  37. Joey

    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!

  38. Joey

    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!

  39. Joey

    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?

  40. Gary Post author

    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 πŸ˜‰

  41. Joey

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

  42. Brad


    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

  43. Gary Post author

    Joey – good work, glad you got there in the end.

  44. Gary Post author

    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


  45. Brad

    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?

  46. Gary Post author

    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.

  47. Brad

    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

  48. Gary Post author

    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.

  49. Brad

    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!

  50. misery_kitty

    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 πŸ˜€

  51. Gary Post author

    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 πŸ™‚

  52. Pingback: Club osCommerce » Version 1.2 of Discount Coupons and Gift Vouchers for RC osCommerce

  53. mike


    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!

  54. taf

    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.

  55. Gary Post author

    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.

  56. Joachim

    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…

  57. girl

    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.

  58. Gary Post author

    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.

  59. Francisco

    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!

  60. Gary Post author

    Francisco; make sure that you have uploaded the file;


  61. Alan

    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.


  62. Gary Post author

    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?

  63. Alan

    I’m using R2 I think. Can’t see where to says it. Is it possable you could sort it out. Can you email me to discuss?

  64. Francisco

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

  65. Gary Post author

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

  66. Francisco

    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!

  67. Gary Post author

    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.

  68. Francisco

    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!

  69. Gary Post author

    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!

  70. Tearitup


    Thanks , or is it better to upgrade to RC 2.
    Is that hard to do.


  71. Gary Post author

    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.

  72. MCousin

    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?

  73. Kevin

    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?

  74. MCousin

    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!

  75. Gary Post author

    Mike – good work.

    Kevin – have a look at Mikes last post.

  76. Craig

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

  77. Gary Post author

    Craig – you know those “language” files that are a part of the contribution… πŸ˜‰

  78. Gary Post author

    Craig – good work. I knew you’d find it if given a prompt.

  79. Michelle

    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?

  80. Gary Post author

    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?

  81. Michelle

    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?

  82. Tearitup

    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.



  83. Alexander

    Burt.. looking forward to the MS 2.2 version πŸ™‚

    Many thanks to you..

  84. Valdez

    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

  85. Gary Post author

    Alexander – soon πŸ˜‰

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

  86. Valdez

    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?

  87. Gary Post author

    Valdez – “Is there a solution?” – not yet πŸ˜‰

  88. Sunny

    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 πŸ™‚

  89. Gary Post author

    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.

  90. Sunny

    thanks Admin, but still got a problem.

    There is no ‘Coupon’ option in the admin section

  91. Gary Post author

    Sunny – you have not followed the full instructions and so now you have some problems. Start again.

  92. Sunny

    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?

  93. Misery_Kitty

    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 πŸ˜‰

  94. simon


    It only took me 13 mins to get it installed and working all ok.

    try it!!!!

  95. Ed

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

  96. Gary Post author

    Ed – does it work with other payment methods? And which version of IPN are you using?

  97. Johan


    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 πŸ™‚

  98. Gary Post author

    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

  99. Gary Post author

    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!

  100. Gary Post author

    Johan – please do let us know how the install went…

  101. Misery_Kitty

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

  102. Gary Post author

    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.

  103. jarzom


    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 ?


  104. jarzom

    Hahahaha, installed the table in wrong data-base.

    Sorry !


  105. Heather

    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

  106. Heather

    Would it be possible to enter the coupon code at checkout_shipping.php instead?

  107. Gary Post author

    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…

  108. David

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

  109. Gary Post author

    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

  110. Heather

    hmmm, I was hoping you might have an “easier” answer…I don’t know php enough to mess with it much. Thank you, though.

  111. Isaac G.


    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.

  112. Gary Post author

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

  113. Ron


    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.


  114. Ron


    how did you adjust the paypal to aggregate? through their site or in Garys’ Voucher code??


  115. Ron

    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.


  116. Gary Post author

    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

  117. Tom

    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…


  118. Gary Post author

    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.

  119. Gary Post author

    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

  120. Tom

    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

  121. Eoin


    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,


  122. Eoin

    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?

  123. Eoin

    Sorry to bother you again,

    but just noticed that the Coupon option is not there.

    Maybe this has something to do with the problem?


  124. Gary Post author

    Eoin – you have not followed the instructions 100%. Start over.

  125. Eoin

    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 πŸ™‚


  126. Avi Sujeeth

    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.

  127. Gary Post author

    Avi – thank you for your feedback. Very appreciated πŸ™‚

  128. Teo

    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!

  129. Gary Post author

    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

  130. Amy

    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.

  131. Gary Post author

    Amy – thank you so much for your feedback πŸ˜€

  132. Francisco

    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.


  133. Francisco

    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?

  134. Gary Post author

    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

  135. Francisco

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


  136. Gary Post author

    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!

  137. Francisco

    Thanks Gary! I’ll give it a go and will let you know what I find out.


  138. Francisco

    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.


  139. Gary Post author

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



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

  140. Francisco

    This seemed to do the trick Gary. Outstanding!! Thank you so much!!!!

  141. Gary Post author

    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!

  142. Frank

    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!

  143. Gary Post author

    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

  144. Luca

    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

  145. Gary Post author

    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.


  146. Craig

    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]

  147. Gary Post author

    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.

  148. Gary Post author

    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.

  149. Heather Perkins

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

  150. Pleased Boy


    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.

  151. mama

    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.

  152. Kendo Rosario

    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?


  153. Gary Post author

    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.

  154. Eso

    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

  155. Gary Post author

    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.


  156. Eso

    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

  157. Eso

    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?


  158. Gary Post author

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

  159. Rosario Kendo

    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.

  160. Gary Post author

    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

  161. mama

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

  162. Jerry V.

    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.

  163. Gary Post author

    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 πŸ™‚

  164. assad nazar

    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…

  165. TechHead

    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.

  166. Felisa

    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.

  167. Gary Post author

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

  168. mama

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

  169. Gary Post author

    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…

  170. DR

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

    Look forward to any replys

  171. Gary Post author

    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


  172. Joe Perkowski

    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

  173. Gary Post author

    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

  174. Joe Perkowski


    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.



  175. Steve Cranson

    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.


  176. Gary Post author

    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

  177. Leslie Cooper aka Coopco

    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?

  178. Gary Post author

    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.

  179. Dep

    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,


  180. Gary Post author

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

  181. Shane

    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

  182. Gary Post author

    Shane – you can download it and install yourself or you can pay to have it installed. Enjoy!

  183. Deo

    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.



  184. Camille


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


  185. Gary Post author

    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.

  186. Rob

    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.

  187. Gary Post author

    Rob – it should install fine on MS2. Just follow the instructions closely and if you run into troubles, see here.

  188. Kevin

    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!


  189. Gary Post author

    Kev – make sure that you have the “sort order” correct in your admin area.

  190. Deo

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



  191. Gary Post author

    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.


  192. Chris

    oops, should realised that wouldn’t post right, I’m sure you know what I mean.:)

  193. Gary Post author

    Chris – read further up the comments – this has been covered at least 3 times…

  194. Chris

    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?

  195. Gary Post author

    Chris – yes – sort order. It cannot be the same as any toher as far as I am aware.

  196. Chris

    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.

  197. Gary Post author

    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…

  198. Chris

    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.

  199. Erik Smith

    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?

  200. Gary Post author

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

  201. Erik Smith

    What if I pay you to fix this for us? This is very important for us that this is ok.

  202. Gary Post author

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

  203. Stephan Gebbers

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


  204. Gary Post author

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

  205. Stephan Gebbers

    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!

  206. Gary Post author

    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.

  207. Stephan Gebbers

    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.


  208. Chad

    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

  209. Gary Post author

    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.

  210. Gary Post author

    All – this modification now works with Tax – see this blog post. This is only available via me installing for you.

  211. Manny

    i would like this feature on my website but i am using version ms2. can you send me the files to update please.

  212. Gary Post author

    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.

  213. Rupe

    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!!)

  214. Gary Post author

    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

  215. Rupe

    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.

  216. Michael

    Thanks! Works flawless and I am using 2003 verison of OSC.

  217. Gary Post author

    Hi Micheal – thanks for letting me know that πŸ™‚

  218. Alan


    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

  219. Gary Post author

    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.

  220. Kells

    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!

  221. Gary Post author

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

  222. Kells

    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.

  223. Kells

    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.

  224. Gary Post author

    Kells – here

    This contribution is compatible with RC1 RC2 RC2a MS2 MS1

  225. Kells

    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?

  226. Gary Post author

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

  227. Yuriy

    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

  228. Heather

    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

  229. Gary Post author

    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.

  230. Gary Post author

    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.

  231. Gary Post author

    Don’t forget that I offer an installation service πŸ˜‰

  232. Yuriy

    Yes, I sent mail to oscshops [at] gmail com about installation but nobody replays…

  233. Gary Post author

    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.

  234. Heather

    Hi Gary

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

  235. Gary Post author

    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.

  236. Heather

    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 πŸ˜€


  237. Pam

    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

  238. Gary Post author

    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.

  239. Gary Post author

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

  240. MCousin

    Is there a way to only give the coupon to certain categories instead of the whole site?

  241. Greg

    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.


  242. Gary Post author

    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

  243. Greg

    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! πŸ™‚

  244. Gary Post author

    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.

  245. Christoforos

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

  246. Gary Post author

    Chris – that’s for a future update…

  247. euan

    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?!


  248. Gary Post author

    Euan – you have installed it incorrectly – start over.

  249. Shelton

    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?



  250. Gary Post author

    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.

  251. Roger

    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?

  252. Gary Post author

    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.

  253. Mike W

    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.


  254. Gary Post author

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

  255. lynda

    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.

  256. Gary Post author

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

  257. Elroy

    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

  258. Gary Post author

    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.

  259. Bennett

    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.



  260. Gary Post author

    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 ^

  261. Bennett

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


  262. Adoncia

    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!


  263. Dennis

    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.

  264. Gary Post author

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

  265. Dennis

    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

  266. Dennis

    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. πŸ™‚

  267. Adoncia

    Hi Gary,

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


  268. Dennis

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

  269. Gary Post author

    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.

  270. Ray

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

  271. Gary Post author

    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!

  272. gosamba

    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.


  273. GMD

    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

  274. Gary Post author

    Gosamba – you have not run the SQL in PHPMyAdmin.

    GMD – good work!

  275. GMD

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

  276. Gary Post author

    GMD – thank you very much. You have made my day πŸ™‚

  277. Chong

    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 ”


  278. Gary Post author

    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.

  279. Chong

    Hi Gary,

    Is the value meant to be ” or it suppose to carried certain value instead of ”.

  280. Gary Post author

    Chong – reinstall – if it isn’t working, it isn’t working.

  281. Dave


    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.

  282. Gary Post author

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


  283. Dave

    fyi… we are running our website live with os commerce v2.2 RC2a, if that makes any difference

  284. Gary Post author

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

  285. cassie

    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.

  286. Gary Post author

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

  287. Troy

    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.


  288. Gary Post author

    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.

  289. Sethman

    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.

  290. Gary Post author

    Sethman – I couldn’t think of a situation where a customer would want to unapply a discount?

  291. Sethman

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

  292. Gary Post author

    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 πŸ˜‰

  293. Milo

    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

  294. Gary Post author

    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.

  295. Milo

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


  296. Gary Post author

    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

  297. Jase

    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 :/

  298. Gary Post author

    Jase – very easy solution πŸ˜‰ Uninstall FEC – FEC is a poorly coded piece of cr4p !

  299. Jase

    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 πŸ™

  300. Gary Post author

    Jase – “does your code work with PWA” – no idea. Not much use am I πŸ˜‰

  301. Melinda

    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!

  302. Gary Post author

    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

  303. Jase

    FEC gone – going to start and try to install your contribution again so fingers crossed!

  304. Ian


    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.


  305. Gary Post author

    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.

  306. Mark

    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?

  307. Gary Post author

    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 ^

  308. Rob

    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.

  309. Jase

    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?

  310. Gary Post author

    Jase – changing the sort order of your modules *miht* cure it. Have shipping mod after the coupon.

  311. Jase

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

  312. Gary Post author

    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…

  313. DR

    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


  314. Gary Post author

    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 πŸ˜‰

  315. butcha

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

    thank you


  316. Lindsay

    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!

  317. oliver

    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

  318. Steve Tipton

    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?

  319. Gary Post author

    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):

  320. Gary Post author

    Oliver – you can download Version 1 of the code at the oscommerce contributions site.

  321. Steve Tipton

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


  322. Gary Post author


    Any where in that file is fine – I usually put it about the “comments” box towards the bottom.


  323. Butcah

    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.



  324. Gary Post author

    Make sure sort order is unique and that the order total module is installed. You can email me on if you wish to enquire about installation prices etc

  325. Robert


    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;)

  326. Gary Post author

    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.

  327. ayman

    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.

  328. Gary Post author

    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.

  329. ayman


    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.

  330. Eddiek

    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!

  331. Eddiek

    ahh nevermind…it was a mistake on my end…works perfectly!
    thanks again for the contrib!

  332. jonathan

    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?

  333. Gary Post author

    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…

  334. Hanna

    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 πŸ™‚

  335. Hanna

    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!

  336. Gary Post author

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

  337. Hank

    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.

  338. Gary Post author

    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.

  339. hwkd

    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.


  340. Kert

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

    Thanks so much,

  341. Chapman

    Any tips to make this work correctly with the Paypal IPN module?

  342. Gary Post author

    Chapman – how about recoding the IPN module so that it works correctly πŸ˜‰

  343. Gary Post author

    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!

  344. Denis

    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.

  345. chuck starck

    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

  346. Gary Post author

    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

  347. tomislav

    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…


  348. Michael Marley

    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?


  349. Gary Post author

    Mike – glad you like it. Please do buy me a beer by clicking on the beer icon on this page. Cheers!

  350. Gary Post author

    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…

  351. tomislav

    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?


  352. Gary Post author

    T – if you send to me the file for the 3rd party module, I can take a quick look and let you know; is it fixable & how muich it will cost.

  353. tomislav

    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…


  354. Joyce v/d L

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

  355. Gary Post author

    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.

  356. Joyce v/d L

    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?

  357. Gary Post author

    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.

  358. Hal

    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

  359. GMD

    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

  360. Gary Post author

    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…

  361. GMD


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

  362. Jacson

    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.


  363. ejda

    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?


  364. Gary Post author

    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.

  365. james


    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?



  366. Gary Post author

    James – in MVersion 4 of this modification, it is possible to see orders made using each coupon.

  367. Tai Kahn

    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

  368. Gary Post author

    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.

  369. Tai Kahn

    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.


  370. Tom

    HI there,

    I am looking for a copy of this for MS2 can you make it available?


  371. Tom

    Hi Gary,

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

  372. George

    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.

  373. Gary Post author

    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.

  374. George

    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

  375. Gary Post author

    Hello George – it needs to be installed by me.

  376. fabian

    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’];

  377. Gary Post author

    Fabian – google is your friend. I also offer an installation service (should you need it), which guarantees a working install of v5 Coupons.

  378. Mark

    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,


  379. Gary Post author

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

  380. Gary Post author


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

    Cheers, Gary

  381. Ali

    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.


  382. Gary Post author

    Ali – most likely you have not enabled the order_total module and given it a unique sort order.

  383. Ali

    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.


  384. Ali


    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.

  385. Ali

    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.

  386. Gary Post author

    Ali – follow the instructions πŸ˜‰ I offer an install service if you cannot manage it.

  387. Jez

    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.


  388. Lewis

    -=-=- 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 πŸ™‚


  389. Lewis

    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?

  390. Gary Post author

    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.

  391. Lewis

    Hmm, well I do like the looks of this mod, how much to install?

    I’ll have to talk to my co-worker, but that should be fine πŸ™‚

  392. Simon

    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?

  393. Gary Post author

    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.

  394. Simon

    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!



  395. Gerard

    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

  396. Gary Post author

    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

  397. Leslie

    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.

  398. Robert

    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?


  399. Gary Post author


    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

  400. Gary Post author

    leslie – suggest to uninstall and reinstall.

  401. Edward Robson


    Just found your fix for PayPal’s IPN 2.3.3 issue. Your the man!

    Regards, Edward

Comments are closed.