Page 1 of 1

Add new product gives HTTP ERROR 500 - seo_url_id gets 0 value

Posted: Fri Apr 09, 2021 6:02 pm
by none
Hi,

Ive got a migrated OC 3.0.3.7. In order to migrate old SEO urls Ive done this here:
viewtopic.php?t=205218
So far everything was ok until I wanted to add a new product. When I tried to save the new product I've got HTTP 500 error in admin.
After investigating the problem I found the following in my error log:

Code: Select all

[09-Apr-2021 09:38:52 UTC] PHP Fatal error:  Uncaught Exception: Error: Duplicate entry '0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO oc_seo_url SET store_id = '0', language_id = '1', query = 'product_id=158', keyword = 'tesztelunk' in /home/tolokapu/public_html/zednew/system/library/db/mysqli.php:41
Stack trace:
#0 /home/tolokapu/public_html/zednew/system/library/db.php(45): DB\MySQLi->query('INSERT INTO oc_...')
#1 /home/tolokapu/public_html/zednew/admin/model/catalog/product.php(124): DB->query('INSERT INTO oc_...')
#2 /home/tolokapu/public_html/zednew/storage/modification/system/engine/loader.php(248): ModelCatalogProduct->addProduct(Array)
#3 /home/tolokapu/public_html/zednew/system/engine/proxy.php(47): Loader->{closure}(Array, Array)
#4 /home/tolokapu/public_html/zednew/admin/controller/catalog/product.php(23): Proxy->__call('addProduct', Array)
#5 /home/tolokapu/public_html/zednew/storage/modification/system/engine/action.php(79): ControllerCatalogProduct->add()
#6 /home/tolokapu/public_html/zednew/admin/controller/startup/router.ph in /home/tolokapu/public_html/zednew/system/library/db/mysqli.php on line 41
I checked my DB and I learned that each time I want to edit or add a new product the seo_url_id field value changes to zero. Even if I just want to edit a product. After certainly with the next product I get error that that is zero is already exist in the database.

Does anyone know what causes this problem?
Thanks

Re: Add new product gives HTTP ERROR 500 - seo_url_id gets 0 value

Posted: Fri Apr 09, 2021 7:08 pm
by JNeuhoff
Make sure your DB table oc_seo_url has an auto increment for its primary index on seo_url_id. Also, that the Next autoindex is set to value beyond the highest current value of seo_url_id. You can do all of this in your PHPMyAdmin.

Re: Add new product gives HTTP ERROR 500 - seo_url_id gets 0 value

Posted: Fri Apr 09, 2021 10:46 pm
by none
Thanks for your reply. Im not sure if Im doing it right. Could you check my attachment. Is it ok if I just tick that box and click "Go"?
Im sorry but I dont have huge knowledge in SQL queries.

Thanks

Re: Add new product gives HTTP ERROR 500 - seo_url_id gets 0 value

Posted: Mon Apr 12, 2021 6:48 pm
by paulfeakins
none wrote:
Fri Apr 09, 2021 10:46 pm
Im sorry but I dont have huge knowledge in SQL queries.
Then maybe you should be paying a developer to do these things?