Jump to content

Prestashop product thumbnails regeneration not working


Recommended Posts

Im importing products with images:

if (count($d->images)) {
    foreach ($d->images as $img) {
        $url = $img->url;
        $cover = boolval($img->cover);
        $position = intval($img->position);

        $image = new Image();
        $image->id_product = $pid;
        $image->position = $position;
        $image->legend = $img->legend;
        $image->cover = $cover;

        if (($image->validateFields(false, true)) === true &&
            ($image->validateFieldsLang(false, true)) === true && $image->add())
            if (!AdminImportController::copyImg($pid, $image->id, $url, 'products', true))

} else {
    file_put_contents('no_images.txt',$d->name." \n", FILE_APPEND);

but images not showing on page. On admin backend(products edit page) images exists and showing but on page frontend they not display. I have to open manually edit product and click Save to "refresh" images and make it possible to load display on page. How to do it in php code? Is there any way to refresh all images in prostashop products or refresh in php code images for product id?


I tried Refresh all thumbnails in Improve-> Design Imges setting and it still not working. 

Thx for help!


Link to comment
Share on other sites

  • 3 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...