Adding product?

Ask the community for help and support.
Post Reply
Dnj1964
Posts: 58
Joined: Fri Nov 06, 2020 8:27 pm
Has thanked: 8 times

Adding product?

Post by Dnj1964 »

Was adding products and everything was working perfect.

Now when product is added, completes the addition with no errors but new product doesn't show in the product list

Checking in the database shows 0 for product id rather than the sequential product number.

1.0.8.0
Dnj1964
Posts: 58
Joined: Fri Nov 06, 2020 8:27 pm
Has thanked: 8 times

Re: Adding product?

Post by Dnj1964 »

Not sure what the issue actually was.

Stupid mans fix!

Go into products and change the product id to next sequential number.
Go into products_to_categories and make same number change

We'll see when I add another product.
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Adding product?

Post by raiwa »

Check that in the database products table the products id has auto increment set.
I’m also wondering how you got this screwed up. Do you have a dB backup from a point where your settings were correct. It might be easier to restore even you have to enter some products again.
Last edited by raiwa on Fri Apr 02, 2021 7:26 pm, edited 1 time in total.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
Dnj1964
Posts: 58
Joined: Fri Nov 06, 2020 8:27 pm
Has thanked: 8 times

Re: Adding product?

Post by Dnj1964 »

Still won't auto increment

SQL query:
ALTER TABLE `products`
MODIFY `products_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=334

MySQL said: Documentation
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Adding product?

Post by raiwa »

Then check if you have another column set to auto increment and remove it.
Or recover a backup, if you have, from a point where the settings where ok.
I wonder how you got these settings wrong.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
ecartz
Lead Developer
Lead Developer
Posts: 2637
Joined: Tue Nov 05, 2019 6:02 pm
Has thanked: 4 times
Been thanked: 181 times

Re: Adding product?

Post by ecartz »

Also make sure that the products_id column is defined as the primary key for the products table.
Dnj1964
Posts: 58
Joined: Fri Nov 06, 2020 8:27 pm
Has thanked: 8 times

Re: Adding product?

Post by Dnj1964 »

product_id is Primary and only key set on products table.

Refuses to auto_increment.
db-1.jpg
db-2.jpg
db-3.jpg
You do not have the required permissions to view the files attached to this post.
ecartz
Lead Developer
Lead Developer
Posts: 2637
Joined: Tue Nov 05, 2019 6:02 pm
Has thanked: 4 times
Been thanked: 181 times

Re: Adding product?

Post by ecartz »

Dnj1964 wrote: Sat Apr 03, 2021 12:13 am product_id is Primary and only key set on products table.

Refuses to auto_increment.
OK. Try the ALTER statement again. It's certainly not going to auto-increment until you set it to auto-increment.

And note, what you need to check is not that it is the only key but that it is the only auto-increment column.
ecartz
Lead Developer
Lead Developer
Posts: 2637
Joined: Tue Nov 05, 2019 6:02 pm
Has thanked: 4 times
Been thanked: 181 times

Re: Adding product?

Post by ecartz »

Code: Select all

ALTER TABLE `products`
MODIFY `products_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=334
Here's the problem. The PRIMARY is not in that statement. So when you run it, it tries to remove the primary key and then it can't be used as an auto_increment. Try

Code: Select all

ALTER TABLE `products`
MODIFY `products_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, AUTO_INCREMENT=334
That should retain the status as a key and add the auto_increment property.
Dnj1964
Posts: 58
Joined: Fri Nov 06, 2020 8:27 pm
Has thanked: 8 times

Re: Adding product?

Post by Dnj1964 »

ecartz wrote: Sat Apr 03, 2021 3:49 am

Code: Select all

ALTER TABLE `products`
MODIFY `products_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=334
Here's the problem. The PRIMARY is not in that statement. So when you run it, it tries to remove the primary key and then it can't be used as an auto_increment. Try

Code: Select all

ALTER TABLE `products`
MODIFY `products_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, AUTO_INCREMENT=334
That should retain the status as a key and add the auto_increment property.
@ecartz Thanks ever so much, that worked perfectly
Post Reply