Post by YarniaPDX » Fri Sep 17, 2010 8:38 am

Is there any way to change the parameters of the coupon codes? I am switching over to OpenCart from Prestashop, and have a lot of coupons floating around out there that are more than 10 characters long, but as I'm inputting them into OpenCart I'm getting the error message that coupon codes need to be between 3 and 10 characters long. This is a pretty big problem, as these coupons won't expire for awhile and I need to be able to still honor them. Any place I can go in and tweak the maximum character allowance?

Thanks!!

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by mystifier » Fri Sep 17, 2010 7:39 pm

The field Coupon.Code is defined in the database as Varchar(10), so you will need to increase the size.

In admin/language/sale/coupon.php, you need to change:

Code: Select all

$_['error_code']          = 'Code must be between 3 and 10 characters!';
...to suit your new size.

In admin/controller/sale/coupon.php, you need to change:

Code: Select all

if ((strlen(utf8_decode($this->request->post['code'])) < 3) || (strlen(utf8_decode($this->request->post['code'])) > 10)) {
...to validate your new size.

That's it!

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by YarniaPDX » Mon Sep 20, 2010 5:34 am

Fantastic, that totally worked. Thanks!

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by chocomarker1 » Sun Feb 27, 2011 3:04 am

totally works - NOT.

i did these changes, and it lets me finally save without making a ruckus.

however, upon checking WHAT opencart saved, is actually the first 10 digits only of the code.

so the code changes in these php files actually dont make opencart save actual more digits but rather just cuts off things after 10 characters. what is the real solution for this? what else needs to be edited for opencart to swallow more than 10 digits?

Newbie

Posts

Joined
Sat Feb 26, 2011 8:36 pm

Post by yiyinlah » Sat Jun 11, 2011 4:08 am

I need this solution too please!

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by s3d » Sun Jul 24, 2011 4:15 am

its works fine
if your going to whine, then make sure you have more than a ounce of braincells and some gratitude for those who are helping you

Follow the above, and of course, edit the table PREFIX_coupon - making the varchar amount of the field 'code' more suitable (e.g. more than 10)

Regards

Matt

http://www.senses.co.uk
Senses Web Soltuions

Latest Releases:
http://www.personalisedcanvas.com/
http://www.stampedelytham.co.uk/


User avatar
s3d
New member

Posts

Joined
Mon Oct 05, 2009 7:13 pm
Location - UK Midlands and North West

Post by yiyinlah » Sun Jul 24, 2011 4:50 pm

How do I edit the table PREFIX_Coupon?

This is very urgent though, please help s3d.

Thank you so much! :)

Btw, this is for v.1.4.9.5 right?

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by Seuldieu » Wed Nov 16, 2011 8:56 am

The above solution works fine.

You need to go into the PHPAdmin of the MySQL database your Opencart installation is using, click the Coupon table and edit the field "Code" (which will should show varchar(10) as the type) and change it to your desired length.

Don't forget to change your error message inside Admin/Language/English/Sale/Coupon.php !

New member

Posts

Joined
Fri Dec 10, 2010 7:21 am

Post by yiyinlah » Thu Nov 17, 2011 4:25 pm

This works for all versions?
I'm using 1.5.1.3 & 1.4.9.5.

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by yiyinlah » Wed Feb 01, 2012 1:01 am

Yeah, it works on 1.5.1.3 :)
Jus remember to edit the PHPmyadmin side, under _coupon table.

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by naderonics » Wed Apr 04, 2012 11:36 am

Hi all,

Thank you for your provided solution. It works but I still have a problem.
I'm on OpenCart 1.5.1.3
I changed the Varchar on the database.
I also changed the php lines on both mentioned pages.

And it works... It creates the coupon with the new number of characters and it works also on the front end. But every time I try to create a coupon (insert coupon) in the backend it generates the error below when I click save.

Warning: Cannot modify header information - headers already sent by (output started at /home/thecashb/public_html/naderonics/OnlineStore/admin/language/english/sale/coupon.php:87) in /home/thecashb/public_html/naderonics/OnlineStore/system/engine/controller.php on line 28Warning: Cannot modify header information - headers already sent by (output started at /home/thecashb/public_html/naderonics/OnlineStore/admin/language/english/sale/coupon.php:87) in /home/thecashb/public_html/naderonics/OnlineStore/system/engine/controller.php on line 29

And although it generates this error, it still works creating the coupon. But obviously it doesn't take me back to the coupon page and say successfully created or anything!

Please please help!!

Newbie

Posts

Joined
Wed Apr 04, 2012 11:31 am

Post by hudbarnett » Thu Jun 14, 2012 6:40 am

Hi there, i too have been faced with Voucher codes which are over 10 characters in length. I followed the suggested process and it works but I do have a question for someone.

Before making the changes to the database and files I was running vqmod so that I could add multiple codes at once. This has now stopped working and I believe that there must be something else that I’d need to change in order to use the vqmod with the extra characters.

Has anyone else come across this?

New member

Posts

Joined
Thu Mar 29, 2012 9:46 pm

Post by hudbarnett » Fri Jun 15, 2012 3:13 am

I managed to fix this after some testing. If you are using the vqmod for Batch Coupon Codes there is a file called vqmod_batch_coupn.xml there is 3 sections that you need to change the characters from 10 to for example 25. Once i did this i was able to upload longer voucher codes up to 25 characters and multiple amounts.

So far its working for me.

New member

Posts

Joined
Thu Mar 29, 2012 9:46 pm

Post by abhishekdaaga » Thu Jun 28, 2012 5:47 pm

Initially I couldn't do it as my admin name was different then in language there was no file so I had to go into language/english then file. Also in Mysql DB changed it.
But finally made it. Thank You mystifier a ton for the way out :)

New member

Posts

Joined
Thu May 03, 2012 3:46 am
Location - India

Post by yiyinlah » Mon Feb 11, 2013 7:48 pm

Again it works for 1.5.4.1! :)
Thank you mystifier!

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by cookie321 » Wed Jun 05, 2013 3:59 pm

Thank you so much, this helped hugely & really easy to follow! :)

Newbie

Posts

Joined
Wed Jun 05, 2013 3:57 pm

Post by YarniaPDX » Fri Mar 21, 2014 12:27 am

So, I'm having this same problem again, even though the code I altered is still intact -- that line of coupon.php reads

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 25)) {
$this->error['code'] = $this->language->get('error_code');

Yet when I enter a coupon whose coupon code is longer than 10 characters, the system truncates it to only 10 characters. I need to be able to input longer coupon codes so they match my gift card codes; do I need to be altering the code somewhere else as well?

Active Member

Posts

Joined
Sat Sep 04, 2010 7:10 am

Post by jens_b » Mon Mar 24, 2014 4:51 pm

YarniaPDX wrote:So, I'm having this same problem again, even though the code I altered is still intact -- that line of coupon.php reads

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 25)) {
$this->error['code'] = $this->language->get('error_code');

Yet when I enter a coupon whose coupon code is longer than 10 characters, the system truncates it to only 10 characters. I need to be able to input longer coupon codes so they match my gift card codes; do I need to be altering the code somewhere else as well?
Scroll up to post by "s3d » Sat Jul 23, 2011 3:15 pm", there is your answer ;)

New member

Posts

Joined
Mon Oct 28, 2013 6:19 pm

Post by smbehm » Wed Nov 19, 2014 3:18 pm

Followed This for OC 1.5.6
The field Coupon.Code is defined in the database as Varchar(10), so you will need to increase the size.

In admin/language/sale/coupon.php, you need to change:
CODE: SELECT ALL
$_['error_code'] = 'Code must be between 3 and 10 characters!';

...to suit your new size.

In admin/controller/sale/coupon.php, you need to change:
CODE: SELECT ALL
if ((strlen(utf8_decode($this->request->post['code'])) < 3) || (strlen(utf8_decode($this->request->post['code'])) > 10)) {

...to validate your new size.

That's it!

And This
Follow the above, and of course, edit the table PREFIX_coupon - making the varchar amount of the field 'code' more suitable (e.g. more than 10)
I found the setting through my PHP Admin>OC_COUPON>COLUMNS>CODE

I changed the length to 15


Thanks for this thread

Newbie

Posts

Joined
Wed Sep 11, 2013 6:20 pm

Post by Ana do Kastelo » Sat Jun 17, 2017 2:24 am

s3d wrote:
Sun Jul 24, 2011 4:15 am
its works fine
if your going to whine, then make sure you have more than a ounce of braincells and some gratitude for those who are helping you

Follow the above, and of course, edit the table PREFIX_coupon - making the varchar amount of the field 'code' more suitable (e.g. more than 10)

Regards

Matt
Hi. I was google searching for this issue. I'm using 2.2.0.0. and need to expand the limit. Where is this PREFIX_coupon setting? I've edited both php and language file and it's still giving me the same max 10 feedback. Maybe the server is slow and will turn out fine in a few hours, it's not the first time changes take time. Anyway, where is that table thing? Please.

Thank you for your support,

Ana.


Posts

Joined
Tue Feb 07, 2017 11:39 pm
Who is online

Users browsing this forum: No registered users and 97 guests