VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: keora on November 21, 2016, 11:01:30 AM

Title: Database error on shipment method
Post by: keora on November 21, 2016, 11:01:30 AM
Hi Everybody!

I got a problem with the shipment methods. Can't edit or create a new one anymore for whatever reason (see attachement).

It exists with and without using a template.

Any idea how to solve it? I am unfortunately very bad at databases.

Thanks a lot!
Stefan
Title: Re: Database error on shipment method
Post by: Milbo on November 21, 2016, 14:00:42 PM
Just use the table updater again. In the tools
Title: Re: Database error on shipment method
Post by: keora on November 21, 2016, 15:03:18 PM
Heyho Milbo!

Thanks for the fast reply.

I hope I used the right selection as I got the German Joomla version.

In German it says "Tools - Updating/Migration - Install tables if necessary or update them" - correct?

If I use that one, I got an error message saying:

Es ist ein Fehler aufgetreten!
1075 Incorrect table definition; there can be only one auto column and it must be defined as a key SQL=ALTER TABLE `#__virtuemart_ratings` DROP INDEX `virtuemart_product_id`

Title: Re: Database error on shipment method
Post by: Milbo on November 21, 2016, 20:00:14 PM
Seltsamer Fehler. Which version did update and which version do you have now?
Title: Re: Database error on shipment method
Post by: keora on November 21, 2016, 20:33:13 PM
I had 3.6.1 and now 3.6.4 - but doesn't work on either version.

I migrated the page two weeks ago - and everything seemed to work - well everything but the shipment apparently. Can't select any shipment methods anymore either but the only one with any costs (pickup).
Title: Re: Database error on shipment method
Post by: Milbo on November 22, 2016, 09:18:19 AM
The table should look like this

CREATE TABLE IF NOT EXISTS `#__virtuemart_ratings` (
  `virtuemart_rating_id` INT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
  `virtuemart_product_id` int(1) UNSIGNED NOT NULL DEFAULT '0',
  `rates` int(1) NOT NULL DEFAULT '0',
  `ratingcount` int(1) UNSIGNED NOT NULL DEFAULT '0',
  `rating` decimal(10,1) NOT NULL DEFAULT '0.0',
  `published` tinyint(1) NOT NULL DEFAULT '1',
  `created_on` datetime NOT NULL default '0000-00-00 00:00:00',
  `created_by` int(1) NOT NULL DEFAULT '0',
  `modified_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified_by` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`virtuemart_rating_id`),
  UNIQUE KEY `virtuemart_product_id` (`virtuemart_product_id`,`virtuemart_rating_id`),
  KEY `published` (`published`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 COMMENT='Stores all ratings for a product';


Please post the definition of your table. I wonder that the updater tries to delete your primary key (deletion of keys is not unusual, but not for primary keys).
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 09:39:40 AM
Hi Milbo!

Thanks a lot for the effort. Gotta hook up with a friend who knows where to put this information and where to get the information you need. I am really a database noob unfortunately and have no idea how to access that table.

Kind regards,
Stefan
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 09:46:36 AM
Or is there any easy step by step solution how to do this?
Title: Re: Database error on shipment method
Post by: Milbo on November 22, 2016, 09:47:22 AM
Quote from: keora on November 21, 2016, 20:33:13 PM
I had 3.6.1 and now 3.6.4 - but doesn't work on either version.

I meant the VirtueMart Versions. Btw, when you updated too late, you may got hacked already.
Title: Re: Database error on shipment method
Post by: Milbo on November 22, 2016, 09:53:49 AM
https://extensions.joomla.org/category/hosting-a-servers/database-management

Also Simple-Adminer z.B.
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 11:55:52 AM
Hey Milbo
Thanks again a lot. Didn't work out though - I installed adminer, but i can't make it work. I activated the adminer, but when i try to connect to the database I only receive a blank space.
JooDatabase can't connect to an existing database and DB Tweaks won't even show up despite being installed and activated.

I tried resetting the DB and VM worked fine again. But then again it makes me lose all products and categories etc.

Is there a possibilty that I reset the DB and then reinstall a backup - or will it just be messed up again?
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 11:59:22 AM
Edit: Ignore my previous post - got Joomla MySQL Manager running. Though I am lost again XD

What table should I edit how? :D
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 12:03:38 PM
Table structure looks like that:
_virtuemart_shipmentmethods

virtuemart_shipmentmethod_id   int(1) unsigned   NO   PRI      auto_increment
virtuemart_vendor_id   smallint(1)   NO      1   
shipment_jplugin_id   int(1)   NO   MUL   0   
slug   char(255)   NO         
shipment_element   char(50)   NO   MUL      
shipment_params   varchar(19000)   NO         
ordering   int(1)   NO   MUL   0   
shared   tinyint(1)   NO      0   
published   tinyint(1)   NO      1   
created_on   datetime   NO      0000-00-00 00:00:00   
created_by   int(1)   NO      0   
modified_on   datetime   NO      0000-00-00 00:00:00   
modified_by   int(1)   NO      0   
locked_on   datetime   NO      0000-00-00 00:00:00   
locked_by   int(1)   NO      0   
Title: Re: Database error on shipment method
Post by: Milbo on November 22, 2016, 14:06:05 PM
We need the structure of the rating table, not shipment
Title: Re: Database error on shipment method
Post by: keora on November 22, 2016, 14:56:17 PM

Field   Type   Null   Key   Default   Extra
virtuemart_rating_id   int(1) unsigned   NO   PRI      auto_increment
virtuemart_product_id   int(1) unsigned   NO   PRI   0   
rates   int(1)   NO      0   
ratingcount   int(1) unsigned   NO      0   
rating   decimal(10,1)   NO      0.0   
published   tinyint(1)   NO   MUL   1   
created_on   datetime   NO      0000-00-00 00:00:00   
created_by   int(1)   NO      0   
modified_on   datetime   NO      0000-00-00 00:00:00   
modified_by   int(1)   NO      0

Sorry :(
Title: Re: Database error on shipment method
Post by: Milbo on November 22, 2016, 17:57:51 PM
The tool is not enough. Because we need the keys.

First you must understand, why you get the error in the updater. Why it tries to change the key if it is already there. It helps to recreate it manually.