nirow Posted October 29, 2017 Share Posted October 29, 2017 (edited) Hello all, We have an issue when we try to add an image to a product under Prestashop 1.6.0.11. We get the following error message: JSON.parse: unexpected character at line 1 column 1 of the JSON data We were able to pinpoint that the issue is due to a bad SQL query where two different tables have the same column name. Here's the server response when we try to upload: Column 'id_product' in where clause is ambiguous SELECT * FROM `as_image` i INNER JOIN as_image_shop image_shop ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1) WHERE `id_product` = 58 AND image_shop.`cover`= 1 LIMIT 1 Is there a way to modify the request to Select the correct table ? Why is this happening in the first place ? We have pretty much no idea what to do from here... any help would be appreciated. Edited October 29, 2017 by nirow (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted October 30, 2017 Share Posted October 30, 2017 Try to enable Debug mode and then look at the AJAX response. I think you should see the error as a part of the response. Link to comment Share on other sites More sharing options...
nirow Posted October 30, 2017 Author Share Posted October 30, 2017 (edited) 2 hours ago, tuk66 said: Try to enable Debug mode and then look at the AJAX response. I think you should see the error as a part of the response. Debug mode is activated (_PS_MODE_DEV_ === true) I first get the error message I posted above then the ajax response that follow is empty: {"order":{"total":"0","results":[]},"customer_message":{"total":"0","results":[]},"customer":{"total":"0","results":[][spam-filter] Anything else I can check ?? If I manually try the request I can get arround by changing WHERE id_product = to WHERE i.id_product = I think the query is generated by AdminProductsController.php But I'm not too sure how to change it. Edited October 30, 2017 by nirow Clarification (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now