diff --git a/common/behaviors/SaveImgBehavior.php b/common/behaviors/SaveImgBehavior.php index 7772400..66be843 100755 --- a/common/behaviors/SaveImgBehavior.php +++ b/common/behaviors/SaveImgBehavior.php @@ -79,17 +79,24 @@ $directory = $fieldset[ 'directory' ]; return empty( $this->owner->$name ) ? NULL : '/storage/' . $directory . '/' . $this->owner->$name; } - + /** - * @param int $field + * @param int $field + * @param bool $dummy * * @return null|string */ - public function getImageUrl($field = 0) + public function getImageUrl($field = 0, $dummy = true) { $fieldset = $this->fields[ $field ]; $name = $fieldset[ 'name' ]; $directory = $fieldset[ 'directory' ]; - return empty( $this->owner->$name ) ? NULL : '/storage/' . $directory . '/' . $this->owner->$name; + if(!empty($this->owner->$name)) { + return '/storage/'.$directory.'/'.$this->owner->$name; + } elseif ($dummy) { + return '/storage/no-image.png'; + } else { + return null; + } } } \ No newline at end of file diff --git a/frontend/views/filter/category-brand.php b/frontend/views/filter/category-brand.php index cd2fba8..f4eb16b 100644 --- a/frontend/views/filter/category-brand.php +++ b/frontend/views/filter/category-brand.php @@ -23,50 +23,64 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => \Yii::t('product', 'Brands').' '.$category->lang->name, + 'label' => \Yii::t('product', 'Brands') . ' ' . $category->lang->name, 'url' => [ 'filter/category-brands', 'category_id' => $category->category_id, ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; + + $emptyBrand = false; + if (!$category->getImageUrl(0, false) || !$brand->getImageUrl(0, false) || empty( $brand->lang->seo_text )) { + $emptyBrand = true; + } ?>