Hi,
A better solution, because easily customizable, and no code lost when updating will be to edit the view "product / show_block_img" via the menu Display > Views in HikaShop and at the top at the file add this code:
<?php
if(!empty ($this->element->images)){
$image = reset($this->element->images);
}
if(isset($image->file_path) && !empty($image->file_path)){
$config = hikashop_config();
$uploadFolder = ltrim(JPath::clean(html_entity_decode($config->get('uploadfolder'))),DS);
$uploadFolder = rtrim($uploadFolder,DS).DS;
$uploadFolder_url = str_replace(DS,'/',$uploadFolder);
$uploadFolder = JPATH_ROOT.DS.$uploadFolder;
$fullPath = $uploadFolder.$image->file_path;
if(!JFile::exists($fullPath)) {
$db = JFactory::getDBO();
$query = 'DELETE FROM '.hikashop_table('file').' WHERE file_path = '.$db->quote($image->file_path).' AND file_type=\'product\'';
$db->setQuery($query);
$db->query();
}
}
?>