View Full Version : Problem with Gift Voucher/Coupon Email Sent to Customer

12-13-2004, 08:05 AM
I am having a problem with the email link that is sent to a customer. When you click the link, it just hangs there and eventually times out. I see it is trying to goto gv_redeem.php


Please let me know if anyone else is having the same problem.

12-13-2004, 01:59 PM
in your URL you have "/~xxxxxx" is this really your username at ipowerweb ? if not it should say /~yourusername where "yourusername" is your account name with ipowerweb.

12-14-2004, 07:23 AM
No, I x'd out the name, so the link couldn't be used, it had a $50 coupon attached. Here is an updated one:

The Gift Voucher is worth $0.00

To redeem this Gift Voucher, please click on the link below. Please
also write down the redemption code which is 26c434 in case you have any


or visit https://host246.ipowerweb.com/~category/ecommerce/os/catalog/
and enter the code during the checkout process

Please let me know if you see anything wrong.

12-14-2004, 08:56 AM
Ok in your URL you have a "/" between "/gv_redeem.php" and "gv_no,26c434", you also have a "," and not a "=" between the "gv_no" and the actual voucher number.

This should actually look like this


Notice mine has a question mark, not a "/". PHP uses the "?" to let the script know that data is coming in and needs to be parsed by the script. This is not happening on your site. Why it is doing this i am at a loss to say.

Did you start out with MAX or is this a 2.2 store that has had the module for gift vouchers added later?

12-14-2004, 01:07 PM
Thanks that did it! I found the problem in the admin/gv_mail.php file:

$message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "\n\n";
$message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '/gv_no,'.$id1 . "\n\n";
} else {
$message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "\n\n";

It's a base install of Max, but looks like there might be a problem with the "Friendly URLS" part of the code. Thanks again...

12-14-2004, 02:18 PM

Thanks again for the help. But I'm having another problem. The Voucher Balance does not get deducted after using a coupon. I can checkout, but when looking at the voucher balance, it stays the same, so it can be used again. Have you seen this problem? Please let me know.


12-14-2004, 02:57 PM
Actully I have made several installations of MAX 1.7 over the last week and sadly i can say that this is not an isolated incident. I have one client who when they purchase a 25 certificate, actualy gives them a $75 credit, others who are having same problem as you.

I am sure it's something to do with us being idiots and having to work with a newer version of the voucher mod. If i figure it out ill inform you, as it stands now, our clients are having us temporarily disable this module in MAX 1.7

Any ideas Michael ????

12-14-2004, 03:37 PM
I am taking a look now to see if I can reproduce it.

12-15-2004, 12:12 AM
I found a topic on the OSCommerce site:


that talks about a few of these problems, but I tried to update the OSCMax files with their recommendations, and it still does not work. I now have 2 problems.

1. Voucher Balance does not decrease when applying it to a purchase, so it can be used over again and again.

2. When making a purchase using a Gift Voucher greater than purchase (so purchase price is $0.00) and choosing Authorize.net as payment choice (forces you to use payment choice) It comes back with a credit card error, due to Authorize.net not being able to use the $0.00.

Problems similar to these are mentioned in the post, but I think what is needed is an update to the current release of the Coupon/Voucher Contribution.


I would try to add myself, but with the use of Templates, this gets a little hairy. Any help with these 2 problems would be greatly appreciated.

12-15-2004, 07:28 AM

I have run a few tests on a demo shop (stock 1.7 install) and I cannot reproduce this.

Here is what I did:

I manually created a gift voucher.
Then purchased it through the shop.
Then as an admin, I validated the voucher, which sends an email to the customer that the voucher is valid.
Next, I returned to the catalog as the customer, and added a product to my cart. The shopping cart box shows the item, and my voucher balance.
Next, I go through checkout, and choose payment method and click the 'Use Gift Voucher Balance' checkbox.
On the next page, I see the order total, including the gift voucher balance subtracted from the order total.
I complete the checkout. The order total is correct.
I return to the catalog as a customer, and add a product to the cart. There is no Gift voucher balance so nothing shows up in the shopping cart.

This was tested on a stock osCMax 1.7 and it works correctly.

Remember, vouchers and coupons are 2 separate things. If someone uses a coupon code, it will not affect their gift voucher balance. Gift vouchers are totally separate from the coupon system when it comes to checking out.

12-15-2004, 11:14 AM
OK, this is what I've done. I created a product GIFT_25, and have also put GIFT_25 in the model number. I go back into the site, buy the Gift Voucher, checkout successfully, and go into my Admin and to Gift Voucher Queue. There is nothing in there to redeem, so it doesn't look like it has been created. The other thing that is not working is the Voucher Balance. I currently have $101.00 in my Voucher Balance. I go into the store and purchase something, tick the "Tick to Use Gift Voucher Account Balance" and checkout, I see an amout taken off my purchase and successfully checkout. But when I go back to the store it still says $101.00 in my Voucher Balance. The link to the store is http://store.category5prod.com It is still in test mode and not active yet, so if you can take a look that would be great. I haven't changed any of the code in the base install, so I don't know what could have changed.


12-15-2004, 11:27 AM
I just created a "bogus" site with the raw install od OSCMax, and it looks like that is working correctly. Is there anywhere I should look for differences in the code? I haven't changed anything relating to Coupons or Vouchers. Thanks for all the help.

12-15-2004, 12:11 PM
The GV code is pervasive through the entire codebase. If you have not been tracking your changes, it will be next to impossible to find where the problem is. (read, not worth the effort).

Since your 'bogus' site is working, copy your template files to a new template directory like test-template, and using the template switching, turn your test template on and see if the vouchers are working. If they are, just use the new site. If not, something in your template edits is killing it.

12-15-2004, 12:13 PM
Actully I have made several installations of MAX 1.7 over the last week and sadly i can say that this is not an isolated incident. I have one client who when they purchase a 25 certificate, actualy gives them a $75 credit, others who are having same problem as you.

I am sure it's something to do with us being idiots and having to work with a newer version of the voucher mod. If i figure it out ill inform you, as it stands now, our clients are having us temporarily disable this module in MAX 1.7

Any ideas Michael ????

Cliff, based on my tests, the problem is with your install or configuration somewhere. I cannot find any problems with the GV system when I run tests.

12-15-2004, 03:55 PM
the installation is fine, the problem has something to do with the session variables, as if they click "refresh" in IE it adds an amount equal to the voucher amount to the "voucher total" displayed on screen. It seems wierd i know but you and i both know ive installed this software about 40000 times.

I am going to go through this clients site and see if i can reproduce the "ghost amount multiply" bug for lack of a better term.

Ill respond here should i re-create it.

12-15-2004, 05:41 PM

Please document and post the exact conditions when this occurs. Start with a fresh installation. Post step by step how you make it occur. Also post what versions of Apache, PHP, MySQL, and anything else you think will help.

I want to reproduce this on the test shop. If I can make it happen, then I can fix it. :)

12-15-2004, 09:17 PM

Thanks for the reply. I took a fresh install and added the additions for authorize.net to work correctly, and now the Gift Vouchers/Coupons are working almost 100% The only problem I am now having is when purchasing a Gift Voucher and redeeming it in the admin, it shows up in the customer Voucher Balance just fine, BUT when using the "Send Gift Voucher" (the link located in the upper right hand corner in the store under Voucher Balance) to someone, the email gets to the user, but when they click on the link sent, it brings them back to the store, and the user is logged in as the person who sent them the Gift Voucher.... I have setup a site on my server with a completely untouched version of OSCMax, and I am reproducing the problem (just to prove it's not me :) I have setup a test account on this site with a Voucher Balance of $150.00, so if you want to try it out yourself go ahead.


Username: [email protected]
Password: password

This site is not live, so go ahead and test. Please let me know what you find out.


12-16-2004, 01:23 PM

Do you also see a similar problem in your stores?


12-16-2004, 01:49 PM
the email gets to the user, but when they click on the link sent, it brings them back to the store, and the user is logged in as the person who sent them the Gift Voucher

I just went to your site, sent the voucher to my email address. Then when I received the email, I clicked the link, and it opened a browser on your site. I was not logged in as a user at that point. I created a new account and the voucher balance was correctly added.

I cannot reproduce you issue using your own shop. The GV system is working fine on your store. You will see that the gv balance has been moved from your test account to the new one that I created. I am not sure what your issue is, but osCommerce isnt it. The app is working fine.

12-16-2004, 02:59 PM
It looks like I figured out the problem. The link that I was getting in e-mail was this:

https://host246.ipowerweb.com/~category/ecommerce/os/testcatalog/gv_redeem.php/gv_no/6e271cda9d?osCsid=70aba9e9c1d92aa79718e5a8fe229fxf (looks like it was sending a session ID with the email)

and after fixing it, it is now this and works:


Could you post the link that was sent to you?

I was also having the problem with the Gift Vouchers being sent from my Admin Module, that red_fraggle helped me out with. The file in the Admin I needed to change was admin/gv_mail.php It looked like the "Friendly URLS" portion was not working correctly. And in the catalog directory I had to change the gv_send.php file to get it to send the correct link in the email. I can now get it to send it correctly. Maybe it is a browser thing, I don't know, but thanks for looking into it.

12-16-2004, 05:23 PM
99.9% of all problems are caused by using the Search Engine safe urls option. It should ALWAYS be turned off. It has not been correctly implemented in the core code, and it breaks just about everything...

12-17-2004, 03:23 PM
Thanks for the info on the Search Engine safe urls option, I didn't know that. I just turned it off and replaced the files I edited (admin/gv_mail, catalog/gv_send) and the Admin Send Gift Voucher Link emailed to the customer is now correct, but the Send Gift Voucher out of the cart still has the osCsid attached to the link

https://host246.ipowerweb.com/~category/ecommerce/os/test/gv_redeem.php?gv_no=58230ae2bb&osCsid=39eba15bf785 35607330830ab699def6

Any ideas why? When using this link, it goes back to the session that was used when it was created if the user has not logged off yet. I'm sure it would eventually/hopefully expire, but the customer is already logged in as me, if I haven't logged off yet. And after testing, if I log off the user does have to login, and it is then under their account, but still with the same osCid, in this case 39eba15bf78535607330830ab699def6, weird, but in the admin/gv_mail it is done differently, and works fine without adding a osCid to the end. Please let me know if you also see a osCid in the email sent from the "Send Gift Voucher" portion of the store.

12-17-2004, 03:33 PM
Try putting this in your .htaccess file:

php_flag session.use_trans_sid off

Then close your browser, open a new instance, visit your admin and try sending again. That may solve the issue.

I am also going to take a look at the files in question.

12-19-2004, 09:06 AM
The admin portion is now working fine, the only issue I had with that with friendly URL's was the link was sent incorrectly. The store "Send Gift Voucher" is the one that is sending the osCsid with the e-mail, is there anyway of turning off the osCsid in the store?


12-19-2004, 09:49 AM
Yes, add the following to your .htaccess file in your public_html dir, as I suggested and let me know if it works:

php_flag session.use_trans_sid off

12-19-2004, 11:36 AM
Sorry about the confusion, I thought you mean't the .htaccess file in my admin directory. I made the change in my .htaccess on my public_html file, and I'm still having the problem.

https://host246.ipowerweb.com/~category/ecommerce/os/test/gv_redeem.php?gv_no=8a2c37174a&osCsid=8e5a19c5d568 ced39077587fd8598778

This is the code in the gv_send.php that is causing the problem:

$gv_email .= EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1);;

I used the code from the admin/gv_mail.php:

message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "\n\n";

and it is now sending the correct link to the customer.


I don't know if this is just an issue with my site, or not, but that worked for me. Let me know if you see any issues with this. Thanks...

12-19-2004, 06:20 PM
I'm glad you have it sorted out finally.

I ran a test through the demo shop with the original code that you were having trouble with (appending session id) and it does not happen on the demo shop. I can only guess as to why this is. It can be many different things from session settings in osCommerce to session settings in php.ini.

Hopefully your diligence in tracking this down will help others who run across this issue.

12-28-2004, 04:22 AM
The author says that he used a line of code from the admin/gv_mail.php but does not say if he replaced a part of the original text or a part of the text or just included the new code in the existing /catalog/gv_send.php. Can one of the admins or the author of this post please clarify a bit more? Im having the same problem and the variations I've tried aren't eliminating the osCsid in the customer sent Gift Voucher Emails.


12-28-2004, 04:41 AM
I tried a few more things and the fix mentioned above does work, the exact code change is below.

change this:

$gv_email .= EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1);;

to this

$gv_email .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "\n\n";

that second snippet (as the previous post explains) comes from the admin/gv_mail.php file which is used to send gift vouchers from the admin panel.