Cannot create more than one custom field of the same type

Started by davidex2, March 04, 2023, 23:21:29 PM

Previous topic - Next topic

davidex2

HI,

I'm trying to create some custom fields. I can only create the first "string" field. If I try to create a second string field this error appears:

vmError: vmTable store insertObject #__virtuemart_customs Duplicate entry 'S-0-1' for key 'field_type_searchable_published' INSERT INTO `jos9z_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','sefggef','','','','addEmpty=0|selectType=0|multiplyPrice=0|transform=\"\"|product_sku=\"\"|product_gtin=\"\"|product_mpn=\"\"|','S','0','0','0','','0','0','','1','0','1','2023-03-04 22:17:47','424','0')

The same problem exists also with the "Properties" and "Boolean" fields.

Joomla 4.2.8
VirtueMart 4.0.12 10777


Lo stesso problema c'è anche con i campi "Proprietà" e "Boleano"

pinochico

I think the name of post have to cannot create more then one custom field of the same name...

But you send there no info about how you create customfield :)

Where is picture?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

davidex2


balai

Seems like is related with the index of the table #__virtuemart_customs with the name: 'field_type_searchable_published'
I suppose that it is a unique index in your case.
Use your phpMyAdmin to go to that table's structure and either delete that index or remove it's unique attribute.

Btw. In my database and under VirtueMart 4.0.12 10777 this index is not unique

davidex2

What exactly should I do?
Being a new installation, is it to be considered a bug of virtuemart?

GJC Web Design

the keys in the install.sql for  4.0.12 10777 are

  PRIMARY KEY (`virtuemart_custom_id`),
  KEY `field_type_searchable_published` (`field_type`, `searchable`, `published`),
  KEY `custom_parent_id` (`custom_parent_id`),
  KEY `virtuemart_vendor_id` (`virtuemart_vendor_id`),
  KEY `custom_element` (`custom_element`),
  KEY `field_type` (`field_type`),
  KEY `is_cart_attribute` (`is_cart_attribute`),
  KEY `is_input` (`is_input`),
  KEY `searchable` (`searchable`),
  KEY `shared` (`shared`),
  KEY `published` (`published`),
  KEY `ordering` (`ordering`)

So I wonder where your Unique came from?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

balai

@GJC it was a core problem. See: https://forum.virtuemart.net/index.php?topic=148315.0

@davidex2 As said: Use your phpMyAdmin to go to that table's structure and either delete that index or remove it's unique attribute.

davidex2

I took a screenshot of the table.

Do I have to modify the field_type_searchable_published line and instead of unique do I have to put index?

Thanks