diff --git a/htdocs/boutique/livre/livre.class.php b/htdocs/boutique/livre/livre.class.php index 56ab198dafd..a47d3fdcfb1 100644 --- a/htdocs/boutique/livre/livre.class.php +++ b/htdocs/boutique/livre/livre.class.php @@ -385,11 +385,18 @@ class Livre { $sql .= " WHERE products_id = " . $this->oscid; + $this->image = $this->ref.".jpg"; + + if(! file_exists(OSC_CATALOG_DIRECTORY."images/".$this->ref.".jpg")) + { + $this->image = OSC_IMAGE_DEFAULT; + } + if ( $this->db->query($sql) ) { $sql = "UPDATE ".DB_NAME_OSC.".products "; $sql .= "SET products_model = '".$this->ref."'"; - $sql .= ", products_image = '".strtolower($this->ref).".jpg'"; + $sql .= ", products_image = '".$this->image."'"; $sql .= ", products_price = ".$this->price.""; $sql .= " WHERE products_id = " . $this->oscid;