Author Topic: Change Product description length (or other fields)  (Read 2191 times)


  • Jr. Member
  • **
  • Posts: 93
Change Product description length (or other fields)
« on: July 30, 2013, 21:17:07 pm »
Ive been al day trying to solve this, and i found the answer!
I will explain so maybe its useful to someone.

I have some lengthy descriptions for my products. And when saving, the text is cut, because it exceed the maximum length for "product_desc" field in the database.
By default my VM 2.0.22a has a 18400 char max length. And i wanted to increase a little.
If i go to my DB and look for the virtuemart_product_en_gb (or the language you installed) table, you can see that "product_desc" field is 18400. And if you try to modify you will get an error. This error is because any ROW of a table can be longer than 65535 bytes. Each character with UTF8 encoding use up to 3 bytes, all the columns of a single row should be no more than 65535 bytes, so the 18400 char default is chosen to fit this limit.
To increase the size of a field, you should decrese the size of other field to be always bellow the limit. So you can shorten your "product_s_desc" from 2000 to 500, and now you can increase "product_desc" to 19900.

BUT you cant do that in the DB, because VM is smarter than you and will change it back again to the default values. So you will have to go to administrator/components/com_virtuemart/helpers/tableupdater.php and find this lines and modify with the values you want.
Code: [Select]
$fields['product_s_desc'] = 'varchar('.VmConfig::get('dbpsdescsize',2000).') '.$linedefault;
$fields['product_desc'] = 'varchar('.VmConfig::get('dbpdescsize',18400).') '.$linedefault;

for example to this:
Code: [Select]
$fields['product_s_desc'] = 'varchar('.VmConfig::get('dbpsdescsize',400).') '.$linedefault;
$fields['product_desc'] = 'varchar('.VmConfig::get('dbpdescsize',20000).') '.$linedefault;

With this mod, now you will have to go to your VM config page, and click "Apply". With this the tables will update to the new size!!

Other option, that does not involve changing PHP files would be to declare 'dbpsdescsize' and 'dbpdescsize' and assign  your value to them. I read that should be declared on virtuemart.cfg but i cant make it work  :(

I hope this is useful to someone, as i spent 1 day to figure it out  ;D


  • Beginner
  • *
  • Posts: 38
Re: Change Product description length (or other fields)
« Reply #1 on: October 21, 2015, 16:24:25 pm »
i changed this line  :
$fields['product_desc'] = 'varchar('.VmConfig::get('dbpdescsize',18400).') '.$linedefault;


$fields['product_desc'] = 'longtext '.$linedefault;

when you have a long text it seems better.


  • Jr. Member
  • **
  • Posts: 187
Re: Change Product description length (or other fields)
« Reply #2 on: March 20, 2017, 15:52:20 pm »
Is there any way to set text or longtext to product_desc field officially?
There is code in tableupdater.php
Code: [Select]
$fields['product_s_desc'] = 'varchar('.VmConfig::get('dbpsdescsize',2000).') '.$linedefault;
$fields['product_desc'] = 'varchar('.VmConfig::get('dbpdescsize',18400).') '.$linedefault;
But it'll be always varchar. What if I need some longer content?


  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9561
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Change Product description length (or other fields)
« Reply #3 on: March 21, 2017, 19:56:58 pm »
I should fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: