I'm importing a catalog of products into the Prestashop store, but there is a problem with the image url broken, because the product is show with a default image with interrogation sign.
My idea is to skip those url and don't use the default unknown image. Any idea for this??
This is the default image used when image url is broken
This is a product with some images by default because of lost images
Thanks for contributing with your help. I could do that script but that solution wont be useful because I import the catalog each hour.
I figured out a solution and it was adding some changes to the Import module, so now the module before import an url it checks file_exists()
and instead of throw a new exception will do unset()
for that image url so with that is enough for my solution. Thanks all.
THis is the code:
// Get images real path, and check exists
foreach ($images as $key => $img) {
/*if (preg_match('/:\/\//', $images[$key]->value)) {
continue;
}*/
$url = $images[$key]->value;
$filename = explode('=',$url)[1];
$images[$key]->value = _PS_ROOT_DIR_.'/testimg/'.$filename.'.jpg';
if (!file_exists($images[$key]->value))
{
unset($images[$key]);
//throw new Exception("File {$images[$key]->value} not found.");
}
}
Product's images are listed in ps_image
table. You should do an script that delete all images that table that are not present in /img/p/
folder.
You could do a image resize in backffoffice images options menu, but I'm not sure if this clean database.
Good luck.