VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: buzi on January 11, 2015, 11:24:48 AM

Title: Product short/long description Database column too short
Post by: buzi on January 11, 2015, 11:24:48 AM
Hi,
Thank you for the recent effort to launch VM version 3. im so happy to be using it.
im migrating an existing shop from a different system to VM 3.
the original products have long descriptions and  they dont fit in the products table columns: product_s_desc (VARCHAR (2000))  and product_desc (VARCHAR(18400))

i tried to change the datatype to TEXT but whenever i save the configuration from the administration panel it overwrites my changes and changes the datatype back to the original settings....

what do you suggest i do ?
Thanks Very much
Title: Re: Product short/long description Database column too short
Post by: AH on January 11, 2015, 13:00:25 PM
If it does not fit into product_desc

18400 varchar is pretty big!

You will have to Truncate if you want to use stock VM3



Title: Re: Product short/long description Database column too short
Post by: buzi on January 11, 2015, 16:07:23 PM
Hi, thanks for your reply.
what if i can't truncate ? its has a lot of HTMl code in it, this is why its so big.
What is "stock VM3" ?
Anyway around the configuration changing back the table columns to the original Datatypes ? i know this is a hack but in my case i cant see a way around it...

Title: Re: Product short/long description Database column too short
Post by: AH on January 11, 2015, 18:37:59 PM
Create yourself another field in the dbase tables

Stick the data in there and reference that in the product detail displays

The dbase table addition is a core hack, but at least you will leave the core fields alone

Maybe someone else has a better suggestion
Title: Re: Product short/long description Database column too short
Post by: buzi on January 11, 2015, 19:04:37 PM
its a good idea but h i wont be able to update those fields from the virtuemart administration products editor...
any other way to make the configuration saving process skip those columns somehow ?
Thanks
Title: Re: Product short/long description Database column too short
Post by: GJC Web Design on January 11, 2015, 21:44:35 PM
you need to dig into the save process - although wouldn't have thought that a simple save of the admin is checking table field types?
quick look I can't see it in the code

Do u mean this is on a save of a product or what do u mean?
Title: Re: Product short/long description Database column too short
Post by: buzi on January 12, 2015, 09:36:06 AM
Hi GJV,
try this:

1.change jos_virtuemart_products_en_gb.product_desc  to TEXT datatype
2.go to
administrator/index.php?option=com_virtuemart&view=config
3.click save, see what happens.

i get this notice:

Taking config from file

"alterTable CHANGE k3r0e_virtuemart_products_en_gb.product_desc : ALTER TABLE `k3r0e_virtuemart_products_en_gb` CHANGE COLUMN `product_desc` `product_desc` VARCHAR(18400) NOT NULL DEFAULT '' AFTER `product_s_desc`"

and this message:
"Table updated: Tablename k3r0e_virtuemart_products_en_gb dropped: 0 altered: 1 added: 0

Configuration Saved"
Title: Re: Product short/long description Database column too short
Post by: GJC Web Design on January 12, 2015, 14:11:21 PM
it comes from the function - seems to be called from the vmplugin.php

public function updateMyVmTables($file = 0, $like ='_virtuemart_'){

      if(empty($file)){
         $file = VMPATH_ADMIN.DS.'install'.DS.'install.sql';
      }

except that the lang tables aren't defined in VMPATH_ADMIN.DS.'install'.DS.'install.sql' and the lang section of that function in vm3.0.3 is commented out

poke around in that area maybe

Title: Re: Product short/long description Database column too short
Post by: buzi on January 13, 2015, 09:01:14 AM
great ! thanks for this
the functions that updates is here:
administrator\components\com_virtuemart\helpers\tableupdater.php
around line 324