Prestashop: Error when adding image in creating new product

Created on 14 Sep 2019  路  3Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
In PS 1.7.6.1, Error when adding image in creating new product, (Turn on debug mode)
Column 'cover' cannot be null INSERT INTO t3e_image (id_product, position, cover) VALUES ('1218', '2', NULL)

To Reproduce
Steps to reproduce the behavior:

  1. In BO, Go to 'Category -> Product'
  2. Click on "New product", after giving any name in product name, then adding image file
  3. First image is ok.
  4. Error appear when inserting second images (OR insert TWO or more images in step 2)
  5. Column 'cover' cannot be null INSERT INTO t3e_image (id_product, position, cover) VALUES ('1218', '2', NULL)
  6. 6.

Screenshots
insert picture error 1-2
insert picture error 2-2

Additional information
PrestaShop version: 1.7.6.1
PHP version: 7.1.30

1.7.6.1 BO Bug No change required Products

All 3 comments

I figured out the problem. This may cause by 1-click upgrade... Somehow, the 'cover' column of 'image' and image_shop did not change to NULLable. In PS 1.6.X. the column cannot be NULL.
This will impact for those products with combination.

As my site was upgraded from 1.6.x using 1-click upgrade.
I installed a fresh 1.7.5.1 installation. Problem does not happen.
Highlight of how to fix.

  1. Amend the 'cover' column to NULLable for TWO tables 'image' and image_shop.
  2. Change existing cover value in image from 0 to NULL
  3. Reinsert missing record in image_shop table

I will test and examine further before applying to my production site.

Hi @dtwfung,

Your problem is solved?

@mariem-abid Yes, solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sandra2n picture sandra2n  路  3Comments

vincent-dp picture vincent-dp  路  3Comments

marionf picture marionf  路  3Comments

matks picture matks  路  3Comments

PrestaShark picture PrestaShark  路  3Comments