Juandbbam Posted June 23, 2010 Share Posted June 23, 2010 Hello,I have set up the Birthday present module, set up a cron and everything goes great. I receive the voucher code, but the problem comes when I enter the code. I get an error message that says: 1. this voucher can only be used in the following currency:Any idea about this problem?Thanks a lot in advance! Link to comment Share on other sites More sharing options...
rocky Posted June 24, 2010 Share Posted June 24, 2010 The PrestaShop team did this on purpose to work around a bug in the voucher calculations. They decided that it is highly likely that customers will use vouchers in the same currency that they purchased in, so they thought it was acceptable to make it so that vouchers can't be used in a currency other than the one that was used in the purchase that generated the voucher. Link to comment Share on other sites More sharing options...
Juandbbam Posted June 24, 2010 Author Share Posted June 24, 2010 Thank you Rocky,But I only have one currency in my shop, Euro. So the order was made in Euro. Link to comment Share on other sites More sharing options...
rocky Posted June 24, 2010 Share Posted June 24, 2010 In that case, it should work. I can't think of a reason why it wouldn't. Link to comment Share on other sites More sharing options...
Juandbbam Posted June 24, 2010 Author Share Posted June 24, 2010 Thank you anyway.I have checked the database and for the Birthday voucher the currency is 0. But it's 0 also for other vouchers manually generated. It's 1 for the Fidelity Vouchers.I have also checked birthdaypresent.php, and I think that the voucher is generated here: public function createTodaysVouchers() { $users = Db::getInstance()->ExecuteS(' 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 \'%'.date('-m-d').'\''); foreach ($users as $user) { $voucher = new Discount(); $voucher->id_customer = intval($user['id_customer']); $voucher->id_discount_type = intval(Configuration::get('BIRTHDAY_DISCOUNT_TYPE')); $voucher->name = 'CUMPLE-'.intval($voucher->id_customer).'-'.date('Y'); $voucher->description[intval(Configuration::get('PS_LANG_DEFAULT'))] = $this->l('Your birthday present !'); $voucher->value = Configuration::get('BIRTHDAY_DISCOUNT_VALUE'); $voucher->quantity = 1; $voucher->quantity_per_user = 1; $voucher->cumulable = 1; $voucher->cumulable_reduction = 1; $voucher->date_from = date('Y-m-d'); $voucher->date_to = strftime('%Y-%m-%d', strtotime('+1 month')); $voucher->minimal = Configuration::get('BIRTHDAY_MINIMAL_ORDER'); $voucher->active = true; if ($voucher->add()) Mail::Send(intval(Configuration::get('PS_LANG_DEFAULT')), 'birthday', $this->l('Happy birthday!'), array('{firstname}' => $user['firstname'], '{lastname}' => $user['lastname']), $user['email'], NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); else echo Db::getInstance()->getMsgError(); } } But I don't see any reference to a currency here. If I go to Discount.php there it says that the currency type is only set for those Discounts type 2 (on quantity), so for the rest the currency type is not set.I will try to set the Birthday discount on amount instead that setting it on % in order to see if it works. Link to comment Share on other sites More sharing options...
Juandbbam Posted June 26, 2010 Author Share Posted June 26, 2010 I changed the birdthay present from % to a fix amount (5€) and the problem remains.I have checked the database and the voucher is saved with a currency_id of 0 (but the manually created ones are also saved as 0 and they don't give any problem)If I manually change the currency_id from 0 to 1 (the id of Euro) the the birdthay voucher code gives no problem at all.Any ideas about how to solve this problem?Thank you in advance. Link to comment Share on other sites More sharing options...
Juandbbam Posted July 2, 2010 Author Share Posted July 2, 2010 Just in case somebody else has this problem, I added this line at the function createTodayVouchers at birthdaypresent.php: $voucher->id_currency = 1; Link to comment Share on other sites More sharing options...
alphabravo8 Posted September 7, 2010 Share Posted September 7, 2010 I have checked the database and the voucher is saved with a currency_id of 0 (but the manually created ones are also saved as 0 and they don't give any problem)If I manually change the currency_id from 0 to 1 (the id of Euro) the the birdthay voucher code gives no problem at all.Thank you in advance. Hi Juandbbam,Thanks for your helpI have the same problem as you had with the birthday voucher but I can't see any relations between my discount table and id_currency in my database.Could you please tell me where I can modify it manually in the database?thks Link to comment Share on other sites More sharing options...
hurrican3 Posted March 14, 2011 Share Posted March 14, 2011 I have checked the database and the voucher is saved with a currency_id of 0 (but the manually created ones are also saved as 0 and they don't give any problem)If I manually change the currency_id from 0 to 1 (the id of Euro) the the birdthay voucher code gives no problem at all.Thank you in advance. Hi Juandbbam,Thanks for your helpI have the same problem as you had with the birthday voucher but I can't see any relations between my discount table and id_currency in my database.Could you please tell me where I can modify it manually in the database?thks I am still having the same problem, no clear solution for currency problem on vouchers by amount (not % percentage)the error is: this voucher can only be used in the following currencywhich part of db, i have to change id_currency from "0" to "1" ?coz there is no dropdown menu to set the curreny while creating new voucher by amount, on PS version 1.3.1thanks for your kindly help.anyone help Link to comment Share on other sites More sharing options...
hurrican3 Posted March 14, 2011 Share Posted March 14, 2011 Finally i have solved the problem:on classes folder - discount.php , i have changed (there are 2 lines including this code)['id_currency'] = intval($this->id_currency); replaced['id_currency'] = 1 /id number of your currency/be sure that u type the correct currency id, check it on BO-payment-currenciesso now voucher by amount is working without getting the (this voucher can only be used in the following currency) error on PS 1.3.1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now