News:

Support the VirtueMart project and become a member

Main Menu

CustoFields: error adding Editor Type Field

Started by Maurizio67, September 17, 2022, 18:32:49 PM

Previous topic - Next topic

Maurizio67

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


hazael

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

Maurizio67


Maurizio67

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?

GJC Web Design

it is asked so many times,,,   your versions?????????????
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

Maurizio67


hazael

#6
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`),

Maurizio67

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?

hazael

Not in the Virtuemart panel. You have to do this directly on the SQL database tables...

Maurizio67

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.

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Maurizio67

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

hazael

#12
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 ;

GJC Web Design

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

Maurizio67

OK,
thank you hazael, thank you GJC Web Design.
I'll follow your suggestions.

Bye
Maurizio