Page 1 of 1

voucher code length

Posted: Mon Nov 12, 2012 3:35 am
by samdz
Hi guys,

When customer order a Gift Voucher; I get a Voucher with 10 charcters; but I need up the numbers of charcters in the voucher code to 15 Charcters;

Any help Please ?


Thank's

Sam

Re: voucher code length

Posted: Tue Nov 13, 2012 12:58 am
by Avvici
Open /admin/controller/sale/voucher.php and find this code:

Code: Select all

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 10)) {
              $this->error['code'] = $this->language->get('error_code');
        } 
Change the 10 to 15. This will allow a validation of 15 digits.

Re: voucher code length

Posted: Tue Nov 13, 2012 1:47 am
by samdz
thank you sir for interst.

BUT it didn't work when customers order a gif voucher,

I think this is only to get error when add a gif manully from admin panel.

Also when change the number 10 to 15 the vouche created but ONLY with 10 numbers .

Any other solution ?

Thank's

Sam

Re: voucher code length

Posted: Tue Nov 13, 2012 3:14 am
by Avvici
Ah, the front end. Just open: catalog/controller/checkout/checkout.php and find this line of code:

Code: Select all

'code'             => substr(md5(mt_rand()), 0, 10), 
Change the 10 to 15.

Cheers O0

Re: voucher code length

Posted: Tue Nov 13, 2012 4:57 am
by samdz
Hi, sorry but I didn't find this in this file,
but I find in these files :
- catlog/controller/checkout/confirm.php (one code)
- catalog/controller/checkout/manual.php (three code)

I have changed all from 10 to 15, BUT always didn't work. ???

regards.

Sam

Re: voucher code length

Posted: Tue Nov 13, 2012 7:03 am
by Avvici
samdz wrote:Hi, sorry but I didn't find this in this file,
but I find in these files :
- catlog/controller/checkout/confirm.php (one code)
- catalog/controller/checkout/manual.php (three code)

I have changed all from 10 to 15, BUT always didn't work. ???

regards.

Sam
I gave you good instructions. What version of OC are you using?

Re: voucher code length

Posted: Tue Nov 13, 2012 3:27 pm
by samdz
I am using the version 1.5.4.1

Re: voucher code length

Posted: Thu Nov 15, 2018 12:57 am
by mylasbags
I'm using v.3.0.1.1. Can someone show to increase the code length in v.3.0.1.1?