Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function PrimaryImage() |
||
36 | { |
||
37 | // If we have associated an image, return it |
||
38 | $image = $this->owner->Image(); |
||
39 | |||
40 | if ($image->exists()) { |
||
41 | return $image; |
||
42 | } |
||
43 | |||
44 | // Next try and get a child product image |
||
45 | $product = $this->owner->AllProducts()->first(); |
||
46 | |||
47 | if (!empty($product)) { |
||
48 | return $product->PrimaryImage(); |
||
49 | } |
||
50 | |||
51 | // Finally generate our no product image |
||
52 | return Helper::generate_no_image(); |
||
53 | } |
||
66 | } |