News:

Support the VirtueMart project and become a member

Main Menu

How to change Custom field -> default value in database for all products

Started by ioslok, July 21, 2018, 10:43:40 AM

Previous topic - Next topic

ioslok

Hello
I have a problem with custom fields, i misspelled the field default value (in Product-> Custom Field) as: Value1; value2; value3; value4; Value5;
As you can see starting from Value2 i inserted a space :-/  by which now the product filtering on the page does not work properly.

Trying to correct this error when correcting the default value in Product-> CF to Value1;Value2;Value3;Value4;Value5;
unfortunately, in the product custom fields are reset and only the first value - Value1 is displayed (all 5 are used for each product only in different order) and I have to manually correct them - after that then the filtering works correctly.

However, the database has more than 500 products and manual correction is a waste of time ;-) so I would like to improve these fields directly in the database.

I tried this:
1. First, I corrected the default value in Product-> CF to Value1;Value2;Value3;Value4;Value5;
2. Then in the database I changed the table lmea0_virtuemart_product_customfields with the following query:
UPDATE lmea0_virtuemart_product_customfields SET customfield_value = LTRIM (customfield_value);

When checking products in the administration panel, any values ​​of the custom fields are displayed properly (nothing is reset to the first value of Value1). However, filtering on web page by custom fields doesn't work correctly :-(
Should I change these values ​​somewhere else in the database or maybe I am doing something wrong?
I am asking for help here because this is not a CF plugin problem but VM configuration only.

Joomla: 3.8.7
Virtuemart: 3.2.14
Custom Filters 2.6.3

Jörgen

This could be done with sql. But there is a component from Regular labs where you can replace strings throughout your database, dbreplacer i think. Can recommend this tool.
Regards
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.