VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Maurizio67 on September 17, 2022, 18:32:49 PM

Title: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 17, 2022, 18:32:49 PM
Hello,
I need to add several Editor-type Custom Fields.

The first has gone ok.
The second causes a
vmError: vmTable store insertObject #__virtuemart_customs Duplicate entry 'X-0-1' for key 'field_type_searchable_published' INSERT INTO `ubk2i_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','Ingredienti','','','','0','X','0','0','0','','0','0','','1','0','1','2022-09-17 16:15:54','449','0')

Can please anyone help me to solve this?

Thanks in advance
Maurizio

Title: Re: CustoFields: error adding Editor Type Field
Post by: hazael on September 17, 2022, 20:03:12 PM
Before creating this post, you used the forum search engine to find the answer to your question?

https://forum.virtuemart.net/index.php?topic=148294.0
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 17, 2022, 20:05:17 PM
Yes I did but with no result

Thanks
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 17, 2022, 20:10:24 PM
I see it's a may 2022 thread.
So, @hazael, I have in September the same issue faced by someone else in May and unresolved?
Title: Re: CustoFields: error adding Editor Type Field
Post by: GJC Web Design on September 17, 2022, 22:14:25 PM
it is asked so many times,,,   your versions?????????????
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 17, 2022, 23:13:19 PM



Quote from: GJC Web Design on September 17, 2022, 22:14:25 PM
it is asked so many times,,,   your versions?????????????
VirtueMart 4.0.7 10701
Title: Re: CustoFields: error adding Editor Type Field
Post by: hazael on September 18, 2022, 13:30:00 PM
This topic has already been discussed in this forum and this bug not exist in the latest version of Virtuemart. You have out of date tables in your database

In table #__virtuemart_customs

change:
UNIQUE KEY field_type_searchable_published  (`field_type`, `searchable`, `published`),
to
KEY field_type_searchable_published  (`field_type`, `searchable`, `published`),
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 19, 2022, 20:04:45 PM
Quote from: hazael on September 18, 2022, 13:30:00 PM
You have out of date tables in your database

Is what I have after downloaded the current "Download VirtueMart now!" and (in order to come out of the routing problem) updating it with the 4.0.7 10701

Is the current "Download VirtueMart now!" release, affected by this problem of wrong KEY setting?
Title: Re: CustoFields: error adding Editor Type Field
Post by: hazael on September 19, 2022, 21:27:34 PM
Not in the Virtuemart panel. You have to do this directly on the SQL database tables...
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 19, 2022, 21:55:36 PM
Yes hazael, but I was answering to your "You have out of date tables in your database", since my database is new, coming from a fresh install.
And the image attached to my previous post showed that currently, the version to download seems to bring Outdated Tables with it.
Title: Re: CustoFields: error adding Editor Type Field
Post by: jenkinhill on September 20, 2022, 11:35:28 AM
Try downloading from http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 20, 2022, 19:59:27 PM
Hello jenkinhill,
do you mean the com_virtuemart.4.0.6.10690.zip in the stable section or one (com_virtuemart.4.0.7.10699.zip - com_virtuemart.4.0.7.10701.zip) in the RC section?
Please note that I'm trying to start a new J4 project and I would like to avoid the known routing problems. That's why I tried the last one, but finding problems with the customfields.

Thanks in advance
Maurizio
Title: Re: CustoFields: error adding Editor Type Field
Post by: hazael on September 20, 2022, 21:27:53 PM
Quote from: Maurizio67 on September 19, 2022, 21:55:36 PM
And the image attached to my previous post showed that currently, the version to download seems to bring Outdated Tables with it.
It is impossible - I checked and the record is correct. It is very possible that even when you tried to install the new version, the old tables were already in the database and the installation of the new version did not update them.
Try to delete (if there's nothing there) and reinstall it... or update the Virtuemart tables directly in the database and the problem will be gone.

CREATE TABLE IF NOT EXISTS `#__virtuemart_customs` (
  `virtuemart_custom_id` INT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
  `custom_parent_id` int(1) UNSIGNED NOT NULL DEFAULT '0',
  `virtuemart_vendor_id` int(1) UNSIGNED NOT NULL DEFAULT '1',
  `custom_jplugin_id` int(1) NOT NULL DEFAULT '0',
  `custom_element` varchar(50) NOT NULL DEFAULT '',
  `admin_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:Display in admin only',
  `custom_title` varchar(255) NOT NULL DEFAULT '' COMMENT 'field title',
  `show_title` tinyint(1) NOT NULL DEFAULT '1',
  `custom_tip` varchar(255) NOT NULL DEFAULT '' COMMENT 'tip',
  `custom_value` varchar(4095) COMMENT 'default value',
  `custom_desc` varchar(4095) COMMENT 'description or unit',
  `field_type` varchar(2) NOT NULL DEFAULT '0' COMMENT 'S:string,I:int,P:parent, B:bool,D:date,T:time,H:hidden',
  `is_list` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'list of values',
  `is_hidden` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:hidden',
  `is_cart_attribute` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Add attributes to cart',
  `is_input` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Add input to cart',
  `searchable` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Available as search filter',
  `layout_pos` varchar(24) COMMENT 'Layout Position',
  `custom_params` text,
  `virtuemart_shoppergroup_id` varchar(255) NOT NULL,
  `shared` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'valid for all vendors?',
  `published` tinyint(1) NOT NULL DEFAULT '1',
  `created_on` datetime,
  `created_by` int(1) NOT NULL DEFAULT '0',
  `ordering` int(1) NOT NULL DEFAULT '0',
  `modified_on` datetime,
  `modified_by` int(1) NOT NULL DEFAULT '0',
  `locked_on` datetime,
  `locked_by` int(1) NOT NULL DEFAULT '0',
  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`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COMMENT='custom fields definition' AUTO_INCREMENT=1 ;
Title: Re: CustoFields: error adding Editor Type Field
Post by: GJC Web Design on September 20, 2022, 22:30:51 PM
or try the VM table updater in the VM Tools
Title: Re: CustoFields: error adding Editor Type Field
Post by: Maurizio67 on September 20, 2022, 22:35:07 PM
OK,
thank you hazael, thank you GJC Web Design.
I'll follow your suggestions.

Bye
Maurizio