/** * Returns a ArrayList of attributed images. If there are no images * attributed the method checks if there's a standard no-image * visualitation defined in SilvercartConfig and returns the defined image * as ArrayList. As last resort boolean false is returned. * * @param string $filter An optional sql filter statement * * @return SS_List * * @author Sascha Koehler <*****@*****.**>, * Sebastian Diel <*****@*****.**>, * Ramon Kupper <*****@*****.**> * @since 11.08.2014 */ public function getSilvercartImages($filter = '') { if (!array_key_exists($filter, $this->images)) { $images = false; $this->extend('overwriteSilvercartImages', $images); if ($images == false) { $images = $this->SilvercartImages($filter); $this->extend('updateGetSilvercartImages', $images); if ($images->count() > 0) { $existingImages = new ArrayList(); foreach ($images as $image) { if (!file_exists($image->Image()->getFullPath())) { $noImageObj = SilvercartConfig::getNoImage(); if ($noImageObj) { $image = new SilvercartImage(); $image->ImageID = $noImageObj->ID; $image->SilvercartProductID = $this->ID; } } $existingImages->push($image); } $images = $existingImages; } } if (!$images instanceof ArrayList || $images->count() == 0) { $noImageObj = SilvercartConfig::getNoImage(); if ($noImageObj->exists()) { $image = SilvercartImage::get()->filter('ImageID', $noImageObj->ID)->first(); if (!$image instanceof SilvercartImage || !$image->exists()) { $image = new SilvercartImage(); $image->ImageID = $noImageObj->ID; $image->write(); } $images = new ArrayList(); $images->push($image); } } $this->images[$filter] = $images; } return $this->images[$filter]; }
/** * Returns the generic image for products without an own image. If none is * defined, boolean false is returned. * * @return mixed Image|bool false * * @author Sascha koehler <*****@*****.**> * @since 27.06.2011 */ public function SilvercartNoImage() { $noImageObj = SilvercartConfig::getNoImage(); if ($noImageObj) { return $noImageObj; } return false; }