1. tonis
  2. RO CSVI
  3. Wednesday, 14 December 2022
  4.  Subscribe via email
Hello,

i want to do a regular update on virtuemart product which will update one custom field with a new value. Now, if the custom field value has changed, the field is addet again and again. But I only want to update the firts value.

I have tried to do it with custom_title + custom_value, also with the custom field name in available fields, but the result is the same. Only if I use it with custom_delete, the field is erased and addet again. But I dont want to do this on everyday basis, because if I understand it right, it creates every time a new row in database, and there are too many product, and regular changes.

J 4.1.5
VM 4.0.7
debug log attached
Attachments (1)
Accepted Answer Pending Moderation
Hello,
i want to do a regular update on virtuemart product which will update one custom field with a new value. Now, if the custom field value has changed, the field is addet again and again. But I only want to update the firts value.

Debug log shows that RO CSVI is not able to find the value of the custom field and so it inserts the value. May I know what is the type of custom field you are trying to import?


Get existing row with customfield value 4
2022-12-14 21:18:43 1 [QUERY] SELECT `virtuemart_customfield_id` FROM `sb079_virtuemart_product_customfields` WHERE `virtuemart_product_id` = 4553 AND `virtuemart_custom_id` = 1888 AND `customfield_value` = '4'
2022-12-14 21:18:43 1 [DEBUG] Store custom available field
2022-12-14 21:18:43 1 [QUERY] INSERT INTO `sb079_virtuemart_product_customfields` (`virtuemart_product_id`,`virtuemart_custom_id`,`customfield_value`,`ordering`) VALUES (4553,1888,'4',5)


I have tried to do it with custom_title + custom_value, also with the custom field name in available fields, but the result is the same. Only if I use it with custom_delete, the field is erased and addet again. But I dont want to do this on everyday basis, because if I understand it right, it creates every time a new row in database, and there are too many product, and regular changes.

In VirtueMart Product import template on Options tab set Delete Custom fields Relations to Yes, save the template and run the import. See attached screenshot. This setting will delete all existing custom fields for a product and import new values from import file. Do remember this setting deletes all the custom field values related to the product and not any specific one. Let me know if this would work in your case.
Attachments (1)
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hello,

thanks for your response.

Debug log shows that RO CSVI is not able to find the value of the custom field and so it inserts the value. May I know what is the type of custom field you are trying to import?

The custom field is type string. Yes it can not find the value of the field for the product, because I want to update it with a new value. The old value previously imported is not there in the new import file.

In VirtueMart Product import template on Options tab set Delete Custom fields Relations to Yes, save the template and run the import. See attached screenshot. This setting will delete all existing custom fields for a product and import new values from import file. Do remember this setting deletes all the custom field values related to the product and not any specific one. Let me know if this would work in your case.

I know about this option, but its not suitable for this case. Some products have many custom fields, and this custom fields are static (not changing, not imported again). So I can not delete all custom fields for the product. I only want to update the one field.
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,
The custom field is type string. Yes it can not find the value of the field for the product, because I want to update it with a new value. The old value previously imported is not there in the new import file.

The only way to update a custom field value is by deleting it and then importing it again. If it is single custom field value to update then you need to use both custom_title, custom_value and custom_delete field and also individual template field. See the below example content


product_sku,custom_title,custom_value,custom_delete,Size
10001,Size,4,Y,3



With the above CSV the value of Size custom field 4 is deleted first and then new value 3 is imported.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!