skip to Main Content

I have a small script for Prestashop 8.1.1, part of which is deleting products by list. When I create the product with its id and call the delete() method, I get this error:

 *313784 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /usr/share/nginx/html/****/classes/Image.php:642
Stack trace:
#0 /usr/share/nginx/html/****/classes/Image.php(210): ImageCore->deleteImage()
#1 /usr/share/nginx/html/****/classes/Product.php(1600): ImageCore->delete()
#2 /usr/share/nginx/html/****/ext/newtry.php(601): ProductCore->deleteImages()
#3 {main}

Around line 642 in the Image class:

// Delete auto-generated images
        $image_types = ImageType::getImagesTypes();
        $sfContainer = SymfonyContainer::getInstance();
        $isMultipleImageFormatFeatureEnabled = $sfContainer->get('prestashop.core.admin.feature_flag.repository')->isEnabled(FeatureFlagSettings::FEATURE_FLAG_MULTIPLE_IMAGE_FORMAT);


Any ideas ?

EDIT: Even if I try to delete the product via Webservice, I get the same error again

2

Answers


  1. This is due to the bug introduced in PrestaShop 8.1. You can implement these changes: https://github.com/PrestaShop/PrestaShop/pull/33407/files, which should help you.

    They are part of the PrestaShop 8.1.2 release 🙂

    Login or Signup to reply.
  2. Just a note: updating to 8.1.2 doesn’t fix this problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search