VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: Banana Joe on June 08, 2020, 18:48:35 PM

Title: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Banana Joe on June 08, 2020, 18:48:35 PM
Hello,
I receive this error when someone tries to change the edit address module on front end to change the shipping address.
I tried by myself with admin account and I have the same error:

1062 - Duplicate entry '0' for key 'PRIMARY'

Anyone can help me to resolve, please?
Thank you!
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Jörgen on June 08, 2020, 19:38:47 PM
This could be because of a JOOMLA update regarding user names that has gone wrong.

Without knowing VM, PHP or Joomla versions impossible to more than guess. With the given information I would say, please visit Joomla user forum.

You are welcome to come back with more information.

Jörgen @ Kreativ Fotografi
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Banana Joe on June 09, 2020, 09:49:55 AM
I'm sorry, I didn't get you the versions: is

Joomla 3.9.19
VM 3.8.2
PHP 7.3.18

I wrote to the hosting support and they say it's not a Joomla problem, but something about an incorrect configuration of the primary key of virtuemart users and the module that calls it is the edit address module.
They also said that the references should be tied to the jhost_awocoupon_vm_user table, so I tried to disintalled the awocoupon component but I have not solved.
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Jörgen on June 09, 2020, 10:23:34 AM
Ypu are still a bit vague about what table, the only mention You give is that the awocoupon user table would be broken.

This would indicate an awocoupon issue if You do not have any specific to tell about any broken virtuemart table or when and how this problem started ?

From the information You have given, talk to awocoupon about the issue.

New install, update etc ?

Jörgen @ Kreativ Fotografi
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Banana Joe on June 09, 2020, 10:54:07 AM
The hosting support indicated the awocoupon table as a possible cause of the problem, so I tried to disintalled the component and the table is gone, but the problem remains.
So they told me to write the vm support because it depends from edit address module.

I don't know when the problem is started because was a user who told me was unable to change his address, and I can't trace it to any installation.

What other information can I give you?
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Jörgen on June 09, 2020, 11:04:47 AM
What table has a duplicate entry ? Find that entry and make Your own conlusions. I have no chrystal ball  8)

Jörgen  @ Kreativ Fotografi
Title: Re: 1062 - Duplicate entry '0' for key 'PRIMARY'
Post by: Banana Joe on June 09, 2020, 12:13:52 PM
That is not so simple.
So, activating the debug there is this error:

https://peacockscoffee.com/index.php/en/component/virtuemart/user?Itemid=0
Duplicate entry '0' for key 'PRIMARY'
/home/ufxqn5u8/domains/peacockscoffee.com/public_html/libraries/joomla/database/driver/mysqli.php:665

Call stack
# Function Location
1 () JROOT/libraries/joomla/database/driver/mysqli.php:665
2 JDatabaseDriverMysqli->execute() JROOT/libraries/joomla/database/driver.php:1421
3 JDatabaseDriver->insertObject() JROOT/administrator/components/com_virtuemart/helpers/vmtabledata.php:83
4 VmTableData->store() JROOT/administrator/components/com_virtuemart/helpers/vmtable.php:1831
5 VmTable->bindChecknStoreNoLang() JROOT/administrator/components/com_virtuemart/helpers/vmtable.php:1767
6 VmTable->bindChecknStore() JROOT/administrator/components/com_virtuemart/models/user.php:1105
7 VirtueMartModelUser->storeAddress() JROOT/components/com_virtuemart/controllers/user.php:203
8 VirtueMartControllerUser->saveData() JROOT/components/com_virtuemart/controllers/user.php:117
9 VirtueMartControllerUser->saveUser() JROOT/libraries/src/MVC/Controller/BaseController.php:710
10 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_virtuemart/virtuemart.php:120
11 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
12 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
14 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
15 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:196
16 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49

Can it be useful?