VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: ISOTTA WEB on October 24, 2024, 11:00:07 AM

Title: SOLVED - I cannot create two custom field of the same type, set the same way
Post by: ISOTTA WEB on October 24, 2024, 11:00:07 AM
Hi there,

I'm writing because I cannot create two custom field of the same type, set the same way. I do a research online but I only found posts from 2023.

I'm using Virtuemart 4.2.18 with Joomla 5.2.0

When I set a new customfiled of the same type and set in the same way of an existed one the system gives me back this error:
    vmError: vmTable store insertObject #__virtuemart_customs Duplicate entry 'S-0-1' for key 'f0r61_virtuemart_customs.field_type_searchable_published' INSERT INTO `f0r61_virtuemart_customs` (`virtuemart_custom_id`,`custom_parent_id`,`virtuemart_vendor_id`,`admin_only`,`custom_jplugin_id`,`custom_element`,`custom_title`,`custom_tip`,`custom_value`,`custom_desc`,`custom_params`,`field_type`,`is_list`,`is_input`,`is_hidden`,`virtuemart_shoppergroup_id`,`is_cart_attribute`,`searchable`,`layout_pos`,`published`,`ordering`,`show_title`,`created_on`,`created_by`,`locked_by`) VALUES ('0','0','1','0','0','0','prova','','','','addEmpty=0|selectType=0|multiplyPrice=0|transform=\"\"|product_sku=\"\"|product_gtin=\"\"|product_mpn=\"\"|','S','0','0','0','','0','0','','1','0','1','2024-10-22 08:06:07','780','0')
     
Set the same way I mean that I can create a custom field "string" researcheable and one not. Stop.

Can you please help me?

Thank you,
    Diana
Title: Re: I cannot create two custom field of the same type, set the same way
Post by: Milbo on November 04, 2024, 13:19:41 PM
Usually it is enough to install VirtueMart again, because it should recreate the keys. Or to use the database tools.

You must check your database and check the table f0r61_virtuemart_customs for the key field_type_searchable_published, which should be just a key, in your case it seems to have the "unique" property set.

Title: Re: I cannot create two custom field of the same type, set the same way
Post by: ISOTTA WEB on November 05, 2024, 09:06:11 AM
Hi Milbo,
Many thanks. It's solved.

You were right, the key of field_type_searchable_published was set as unique. I changed it and it works.

Thank you,
Title: Re: SOLVED - I cannot create two custom field of the same type, set the same way
Post by: Milbo on November 12, 2024, 20:54:18 PM
Nice that this is solved. "Or to use the database tools." I mean of course our database tools in the tools section. The buttong "update db and so on" should have solved it. I wonder how it got set to unique?
Title: Re: SOLVED - I cannot create two custom field of the same type, set the same way
Post by: ISOTTA WEB on November 13, 2024, 08:45:07 AM
No clue at all. It worked, I think until, an update a couple of months ago, but I didn't use the custom fields again until now.

I was in panic, not even thought about the database tool. Even if you mentioned it. :-[