src/extensions/CategoryExtension.php
public function PrimaryImage()
    {
        // If we have associated an image, return it
        $image = $this->owner->Image();

        if ($image->exists()) {
            return $image;
        }

        // Next try and get a child product image
        $product = $this->owner->AllProducts()->first();

        if (!empty($product)) {
            return $product->PrimaryImage();
        }

        // Finally generate our no product image
        return Helper::generate_no_image();
    }
public function PrimaryImage()
    {
        // If we have associated an image, return it
        $image = $this->owner->Image();

        if ($image->exists()) {
            return $image;
        }

        // Next try and get a child product image
        $product = $this->owner->AllProducts()->first();

        if (!empty($product)) {
            return $product->PrimaryImage();
        }

        // Finally generate our no product image
        return Helper::generate_no_image();
    }
public function PrimaryImage ( ) { // If we have associated an image, return it $ image = $ this -> owner -> Image ( ) ; if ( $ image -> exists ( ) ) { return $ image ; } // Next try and get a child product image $ product = $ this -> owner -> AllProducts ( ) -> first ( ) ; if ( ! empty ( $ product ) ) { return $ product -> PrimaryImage ( ) ; } // Finally generate our no product image return Helper :: generate_no_image ( ) ; }
Gets the main image to use for this category, this
can either be the selected image, an image from the
first product or the default "no-product" image.

@return Image
Gets the main image to use for this category this can either be the selected image an image from the first product or the default no - product image .