Search code examples
phpsqlprestashop

Can't update stock quantity in prestashop BO


My shop (Prestashop 1.6) is having issues with setting the quantity available for new products. Since I moved my site hosting, when I create a new product, I can't set a quantity value. Each time I put a number and save, the input goes back to 0... This happen for all the new products I add whether it is a simple product or one with combinations. On existing product there is no problem. I am using the default stock management system.

While searching for where this could come from, I noticed that on the db table ps_stock_available, new rows are not properly created for newly added products. Each time a new product is added, a row is created with the correct product id and quantity set to 0 (which is normal at this point) but the column id_stock_available is set to 0… In the BO, when changing the quantity of this product, nothing is saved in the db and the input goes back to 0. If I decide to create another new product, the row of this product is created with the new product id and id_stock_available still set to 0 but the row of the previously created product disappears. I think it is deleted because it has the same id 0 for id_stock_available than the product created after.

I have been searching for how to fix this but nothing works :/

Does anyone had a similar problem or knows how to fix this one ? Thanks for the help!

Cheers,


Solution

  • I finally understood where this was coming from! The column id_stock_available wasn't set on AUTO_INCREMENT... I don't know why this was not the case but after updating the table, everything started working fine again!