Jump to content

Birthday present gift vouchers


Lpeek

Recommended Posts

I've set up the birthday present module which generates vouchers whenever it is a users birthday. I have just tested it and when I enter the voucher code that is generated (which is always BIRTHDAY) i just get the error 'you cannot use this voucher'

I renamed the voucher to something unique (as there is now more than one voucher called BIRTHDAY after 2 users have had a present) and it works fine. so i have two questions:

1. If there is going to be a conflict why does the code generate every voucher with the same code? was this a bug that has now been fixed as I'm running an old version?

2. How do I fix this myself? as I now have over 100 birthday vouchers generated which are invalid as they all have the same, automatically generated, voucher code of BIRTHDAY.

Has anyone had this problem before?

Thanks! :)

Link to comment
Share on other sites

Hi

I've just the same problem :

Change this line :

$voucher->name = 'birthday';



To

$voucher->name = 'birthday'.$user['id_customer'];





Bonus : if you want to send vouchers some days before :

Do this :

$today=date("Y-m-d");
$today10bef=strftime("-%m-%d", strtotime("$today + 10 days"));
$limitreduc=strftime("%Y-%m-%d", strtotime("$today + 6 months"));

$rq='SELECT DISTINCT c.id_customer, firstname, lastname, email
FROM '._DB_PREFIX_.'customer c
LEFT JOIN '._DB_PREFIX_.'orders o ON c.id_customer = o.id_customer
WHERE o.valid = 1
AND c.birthday LIKE \'%'.$today10bef.'\'';
$users = Db::getInstance()->ExecuteS($rq);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...